Brian Wisti wrote:
>>Or in irb:
>> > Array.methods.sort
<snip>
> This is one of those situations where I kinda miss Python and its
> ability to store and later display the docstring of a function or class
> when requested.
>
> One thing at a time, I suppose.
Why bloat the ruby executable with docstrings when you can easily add ri
to irb? After all, irb is where you want to access the docs. Here's the
relevant part of my .irbrc:
def ri arg
puts `ri #{arg}`
end
class Module
def ri(meth=nil)
if meth
if instance_methods(false).include? meth.to_s
puts `ri #{self}##{meth}`
end
else
puts `ri #{self}`
end
end
end