ri is a tool that allows Ruby documentation to be viewed on the command-line. It is part of RDoc and is expected to work on any platform supported by Ruby.
ri will be a bit slow the first time that it runs (or any time that the underlying documentation changes) because it builds a cache in the .ri directory within the user’s home directory in order to make future accesses faster.
To see information for a class, do:
ri class_name
For example, for the Array class, do
ri Array
To see information for an instance method, do:
ri class_name#method_name
For example, for Array’s join method, do:
ri Array#join
To see information for a class method, do:
ri class_name.method_name
For example, for Module’s private method, do:
ri Module.private
To search for all methods containing read, do:
ri read
To search for all methods starting with read, do:
ri '^read'
To search for all read methods, do:
ri '^read$'
ri supports a variety of options, all of which can be viewed via --help. Of particular interest, are:
List of directories from which to source documentation in addition to the standard directories. May be repeated. This can be used to specify the location of site-specific documentation (which can be generated with RDoc).
This makes ri go into interactive mode. When ri is in interactive mode, it will allow the user to disambiguate lists of methods in case multiple methods match against a method search string. It also will allow the user to enter in a method name (with auto-completion, if readline is supported) when viewing a class.
Send output to stdout, rather than to a pager.
All options also can be specified through the RI environment variable. Command-line options always override those specified in the RI environment variable.
Generated with the Darkfish Rdoc Generator 2.