Re: PBI: possible ri improvements
Eric Hodel <[email protected]>
| Newsgroups | gmane.comp.lang.ruby.documentation |
|---|---|
| Message-ID | <[email protected]> |
On Aug 20, 2006, at 3:58 PM, Rich Morin wrote: > I've been doing some Sunday reading: > > Interface-Oriented Design > Ken Pugh > Pragmatic Bookshelf, 2006, ISBN 0-9766940-5-0 > > In the process, I started thinking about ways that ri > could be improved. Here are some Partly-Baked Ideas. > > > Disambiguation > > If ri is asked about a string (such as "to_i") that appears > in multiple method names, it simply lists the matches: > > More than one method matched your request. You can refine > your search by asking for information on one of: > > Float#to_i, Float#to_int, Integer#to_i, Integer#to_int, > IO#to_i, ..., Zlib::GzipFile#to_io > > I see two problems with this approach. First, all of the > results are jumbled together. Second, very little information > is given about the individual results. How about: > > More than one method matched your request. You can refine > your search by asking for information on one of: We'll be integrating risearch after 1.8.5, probably as ri -f or similar. (Committing only to HEAD tends to leave things forgotten.) I'll probably also change it to a list view instead of a jumble. > To be sure, there are some implementation difficulties with > this idea. Specifically: > > * Some information will need to be gathered: > > - "generic" descriptions, such as "returns an integer > representation". > > - "same as" information for methods > > - "stand-alone" descriptions that don't rely (much) on > context from a full ri response. > > * There is the possibility of multiple, clashing generic > descriptions (e.g., method "foo" does really different > things in different classes). Then again, this could > indicate something to address in the naming... At worst you just grab the first N characters of the comment. This is a really easy solution and will probably be good enough. > Context > > Unix man pages have "SEE ALSO" sections that list other, > closely-related man pages. Something like this might be > useful in ri. > > It might also be useful to display a "family tree" that > shows where the same method shows up in related classes. I'd also like to get "file name implemented in", which will be especially helpful with gems. -- Eric Hodel - [email protected] - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com