=======================================================================
ri - Ruby Information at your fingertips
=======================================================================

* Do you need to know the parameters to Time::at? Just type

  % ri  Time.at
  ----------------------------------------------------------------------
     Time.at( aTime ) -> aTime Time.at( seconds [, microseconds] ) ->
     aTime
  ----------------------------------------------------------------------

     Creates a new time object with the value given by aTime, or the
     given number of seconds (and optional microseconds) from epoch.

        Time.at(0)           #=> Wed Dec 31 18:00:00 CST 1969
        Time.at(946702800)   #=> Fri Dec 31 23:00:00 CST 1999


* How do I use 'each_with_index'?

  % 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}


* What classes define a method called 'at'?

  % ri at
  The method named `at' is not unique among Ruby's classes and modules:
     Array#at, Time::at



* Give me a synopsis of module Enumerable:

  % ri Enumerable
  ----------------------------------------------------------------------
     module: Enumerable
  ----------------------------------------------------------------------
     The Enumerable mixin provides collection classes with several
     traversal and searching methods, and with the ability to sort. The
     class must provide a method each, which yields successive members
     of the collection. If Enumerable#max, #min, or #sort is used, the
     objects in the collection must also implement a meaningful <=>
     operator, as these methods rely on an ordering between members of
     the collection.
  ----------------------------------------------------------------------
     collect, detect, each_with_index, entries, find, find_all, grep,
     include?, map, max, member?, min, reject, select, sort, to_a
  ----------------------------------------------------------------------


=======================================================================

'ri' takes the reference section from the book Programming Ruby and
gives you access from the command line.


  % ri Name

        displays a synopsis for class or module 'Name', along with a
        list of methods in that class or module.

  % ri Name::method
  % ri Name#method
  % ri Name.method

        displays the calling sequence and description of the named
        method in the given class. The '::' form looks for a class
        method, the '#' form looks for an instance method, and the '.'
        form looks first for an instance method and then for a class
        method. You may need to escape the '#' character on some
        shells.

  %ri method

        if 'method' is a unique name for a method in all the built-in
        classes and libraries, display its calling sequence and
        description. Otherwise, display a list of the classes and
        modules that define it.

Install by running 'ruby install.rb'. This will put the reference
materials and the file refdoc.rb in your site_ruby directory, and the
'ri' program in the same directory as your ruby executable. Under
Windows, the 'ri' program will be installed as 'ri.rb', so you can
invoke it as

  C:\>  ri.rb  name


=======================================================================

Dave Thomas, 2001
dave@pragmaticprogrammer.com