October 2006
Intermediate to advanced
888 pages
16h 55m
English
The ri is apparently named from “Ruby index” or some such mnemonic. It is a command-line documentation tool, offering information on Ruby classes, methods, modules, and so on. Here is an example:
$ ri each_with_index
--------------------------------------------------------
enumObj.each_with_index {| obj, i | block } -> nil
--------------------------------------------------------
Calls block with two arguments, the item and its index,
for each item in enumObj.
hash = Hash.new
%w(cat dog wombat).each_with_index {|item, index|
hash[item] = index
}
hash #=> {"dog"=>1, "wombat"=>2, "cat"=>0}Note that it has a few bugs and quirks. You are encouraged to report these (along with typos and other inaccuracies) if you can find anyone ...
Read now
Unlock full access