RI.rdoc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. = RI
  2. +ri+ is a tool that allows Ruby documentation to be viewed on the command-line.
  3. You can use +ri+ to look up information from either the command line or
  4. interactively. When you run +ri+ without any arguments it will launch in
  5. interactive mode. In interactive mode you can tab-complete class and method
  6. names.
  7. == Usage
  8. To see information for a class, do:
  9. ri ClassName
  10. For example, for the Array class, do:
  11. ri Array
  12. To see information on a method on a class, do:
  13. ri ClassName.method
  14. This will show both instance and class methods. For example, the IO
  15. class defines both IO::read and IO#read:
  16. ri IO.read
  17. To see information for an instance method, do:
  18. ri ClassName#method_name
  19. For example, for Array's +join+ method, do:
  20. ri Array#join
  21. To see information for a class method, do:
  22. ri ClassName::method_name
  23. For example, for Module's +private+ method, do:
  24. ri Module::private
  25. To read documentation for all +read+ methods, do:
  26. ri read
  27. == Options
  28. +ri+ supports a variety of options, all of which can be viewed via +--help+.
  29. Of particular interest, are:
  30. [<tt>-f</tt>]
  31. Outputs ri data using the selected formatter. You can see the available
  32. formatters in <tt>ri --help</tt>
  33. [<tt>-T</tt>]
  34. Send output to stdout, rather than to a pager.
  35. All options also can be specified through the +RI+ environment variable.
  36. Command-line options always override those specified in the +RI+ environment
  37. variable.
  38. The +RI_PAGER+ environment variable allows you to choose a particular pager or
  39. particular options for your pager.