From: Michael Fellinger Date: 2009-01-11T00:44:51+09:00 Subject: Re: Ruby introspection???? 2009/1/10 Radosław Bułat : > On Sat, Jan 10, 2009 at 11:09 AM, Robert Klemme > wrote: >>>> 2.) help(obj) -> >>> >>> 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 # # help :Method http://github.com/rubyspec/matzruby/tree/trunk/lib/irb/cmd/help.rb ^ manveru