Looking up help on ruby methods and classes from the command line sounds simple but can be very useful if you don’t know or don’t remember.
ri is the equivalent of ‘man’ command in unix (I always confuse this with rdoc which is for generating html documentation, I think perldoc has something to do with this confusion).
Some example commands are
prompt> ri Class
prompt> ri alias_method
In case multiple classes have the same method and you are searching for a method
prompt> ri method_missing
ri will show a message like this:
More than one method matched your request. You can refine
your search by asking for information on one of:
You can then look for the specific method using:
prompt> ri Kernel#method_missing
Update: I just discovered that Class#method is for instance methods, if you want to look help class methods then it is done using Class::method.
ri Hash::new # shows details of the Hash class's new method
ri Hash#delete # shows details of the hash instance's delete method
Also found this interesting reference:
Ruby RI – Using Ruby’s RI Documentation Reader