What is the difference between ri and rdoc What is the difference between ri and rdoc ruby ruby

What is the difference between ri and rdoc


RDoc [..] is the embedded documentation generator for the Ruby programming language. [..] RDoc is included as part of the Ruby core distribution.

RDoc also provides the engine for creating Ruby ri data files. ri is (more or less) Ruby's version of man pages, serving up API information from the command line.

From:http://en.wikipedia.org/wiki/RDoc


To access the local RDoc for your gems, type gem server and point your browser to http://localhost:8808.

If the RDocs for your gems aren't installed, gem rdoc --allwill install the documentation for all of your gems.

It might seem like local documentation isn't necessary. Many developers purposefully skip installing it in favor of online documentation. However, for those of us using legacy tools like Rails 2, it can make finding the right documentation fast and easy.


  • RDoc automatically generates documentation from the comments andstructure of your code. https://github.com/rdoc/rdoc So thinkDoxygen. Use it to generate automatic documentation for code you have written.
  • ri is offline help files for example if you don't have internet. http://www.caliban.org/ruby/rubyguide.shtml#ri Think perldoc. Use it when you have a question about a class, like ri Enumerator should bring up

Enumerator < Object


= Includes: Enumerable (from ruby core)

(from ruby core) ------------------------------------------------------------------------------ A class which allows both internal and external iteration.

An Enumerator can be created by the following methods. * Kernel#to_enum * Kernel#enum_for * Enumerator.new

Most methods have two forms: a block form where the contents are evaluated for each item in the enumeration, and a non-block form which returns a new Enumerator wrapping the iteration.

enumerator = %w(one two three).each puts enumerator.class # => Enumerator enumerator.each_with_object("foo") do |item,obj| puts "#{obj}: #{item}" end # foo: one # foo: two # foo: three enum_with_obj = enumerator.each_with_object("foo") puts enum_with_obj.class # => Enumerator enum_with_obj.each do |item,obj| puts "#{obj: #{item}" end # foo: one # foo: two # foo: three

This allows you to chain Enumerators together........