Pry (an IRB alternative) supports documentation browsing:
$ pry
[1] pry(main)> require 'csv'
#=> true
[2] pry(main)> csv = CSV.new('')
#=> <#CSV io_type:StringIO encoding:UTF-8 lineno:0 col_sep:"," row_sep:"\n" quote_char:"\"">
[3] pry(main)> show-doc csv.first
From: enum.c (C Method):
Owner: Enumerable
Visibility: public
Signature: first(*arg1)
Number of lines: 8
Returns the first element, or the first n elements, of the enumerable.
If the enumerable is empty, the first form returns nil, and the
second form returns an empty array.
%w[foo bar baz].first #=> "foo"
%w[foo bar baz].first(2) #=> ["foo", "bar"]
%w[foo bar baz].first(10) #=> ["foo", "bar", "baz"]
[].first #=> nil
According to the docs, you don't have to generate the documentation beforehand:
The Pry documentation system does not rely on pre-generated rdoc
or
ri
, instead it grabs the comments directly above the method on demand.
This results in speedier documentation retrieval and allows the Pry
system to retrieve documentation for methods that would not be picked
up by rdoc
.