I tried this and it works great!

Thanks, Joel, for a most useful tip.

Mark Lindsay

On Fri, Feb 06, 2004 at 04:46:19AM +0900, Joel VanderWerf <vjoel / PATH.Berkeley.EDU> wrote:
> Charles Comstock wrote:
> >Now that we have alot of the standard docs in ri format available in 
> >general do we have any integration between ri and irb?  That would be 
> >nice to be able to easily call them from within irb.  I mean I suppose 
> >you could just call `ri Array` or whatever, but nonetheless it seems 
> >some integration is possible.
> 
> Put something this in your .irbrc file:
> 
> ==== .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}`
>       else
>         super
>       end
>     else
>       puts `ri #{self}`
>     end
>   end
> end
> ===============
> 
> Then you can do:
> 
> irb> String.ri
> irb> ri String  # same as above
> irb> String.ri 'reverse'
> irb> ri 'File.new'