Irb documentation queries?


#1

Hello all,

I am coming from python and loving ruby (the language), but trying to
figure out some of the tools/capabilities.

Would anyone be so kind as to tell me whether irb has a way of seeing
documentation strings in the source code (as in ipython)?

Many thanks,

Ben Racine


#2

Benjamin J. Racine schrieb:

Hello all,

I am coming from python and loving ruby (the language), but trying to figure out some of the tools/capabilities.

Would anyone be so kind as to tell me whether irb has a way of seeing documentation strings in the source code (as in ipython)?

Many thanks,

Ben Racine

type
help name
for the documentation or use
ri names
on command-line

for example:
$ ri ‘Array::[]’
or
irb> help ‘Array::[]’

or install fastri:
http://eigenclass.org/hiki/fastri
it’s faster :wink:


#3

Benjamin J. Racine wrote:

Would anyone be so kind as to tell me whether irb has a way of seeing
documentation strings in the source code (as in ipython)?

No, it’s not possible. Although in Ruby the documentation is embedded in
the source code, it’s not something the interpreter/compiler really
sees. There’s an external tool you use to call up this documentation.