2009/1/10 Radosaw Buat <radek.bulat / gmail.com>:
> On Sat, Jan 10, 2009 at 11:09 AM, Robert Klemme
> <shortcutter / googlemail.com> wrote:
>>>> 2.) help(obj) -> <no brainer>
>>>
>>> Doesn't exist.  Ruby does not have documentation metadata attached to
>>> objects.
>
> But it doesn't change situation for core/stdlib classes. Python's
> __doc__ is very useful, specially when someone is learning language
> and playing with it interactive shell. For Ruby I have defined method
> 'ri' in my ~/.irbrc file:
>
>    def ri(*names)
>      system("ri %s" % names.map(&:to_s).join(" "))
>    end
>
> so I can type in irb: ri 'Array#zip' and rdoc documentation is
> displayed. IMHO __doc__ is better because for nested calls
> (obj.method1().method2().attribute) in ruby you should first know what
> class you have (ok you don't but type 'ri zip' and you get 20
> different choices).

Actually, irb ships with a help method already, just seems nobody
knows about it:

sigma ~ % irb
method :help
# #<Method: Object(IRB::ExtendCommandBundle)#help>
help :Method

http://github.com/rubyspec/matzruby/tree/trunk/lib/irb/cmd/help.rb

^ manveru