From: Mark Hubbart Date: 2004-10-06T06:49:54+09:00 Subject: Re: Use ri from irb ? On Wed, 6 Oct 2004 05:56:02 +0900, Dave Thomas wrote: > > On Oct 5, 2004, at 15:41, Mark Hubbart wrote: > >> Add the following to your .irbrc file: > >> > >> def ri(*names) > >> system(%{ri #{names.map {|name| name.to_s}.join(" ")}}) > >> end > > > > Is it just me, or does that look a bit kludgy? ri itself is a ruby > > script, and a ruby lib. It seems to me that there should be a clean > > way of including the ri documentation in every object's methods... ie: > > It is a tad kludgy, but not too bad... In the chapter I wanted to > illustrate extending irb, rather than working on the issues on > integrating something such as ri. > > The extension that you describe would be a wonderful add on: I just > didn't have space in the book to show its development. :) I wasn't intending to criticize your code (or your book)... It's a good fix for the problem, especially when seen in the light of it being a concise example of how to extend the behavior of irb. I have something vaguely similar to that in my .irbrc file (but mine looks much more kludgy, makes generous use of backticks, and occupies the greatest part of the file :) I just think that eventually, it would be nice to have it built into the irb libraries, and when it does, it should be custom tailored for it's purpose. The question is, how difficult is it to get at the documentation via the ri libraries? hmmm... cheers, Mark