This post originated from an RSS feed registered with Ruby Buzz
by Eric Hodel.
Original Post: Unleashing ri
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Now that ruby 1.8.5 has been released (Changelog) and ri includes a bunch more documentation and integrates with gems you just might be suffering from ri overload.
$ ri --system -l | wc -l
8882
$ ri -l | wc -l
11918
$ echo 11918 - 8882 | bc
3036
I have 31 extra gems installed, including Rails, which gives me a ton more at-my-fingertips documentation! Some people would rather have less documentation, and there are a handful of new options that control where ri will search for documentation.
$ ri -h
[...]
--doc-dir, -d <dirname>
A directory to search for documentation. If not
specified, we search the standard rdoc/ri directories.
May be repeated.
--system Include documentation from Ruby's standard library:
/usr/local/share/ri/1.8/system
--site Include documentation from libraries installed in site_lib:
/usr/local/share/ri/1.8/site
--home Include documentation stored in ~/.rdoc:
/Users/drbrain/.rdoc
--gems Include documentation from Rubygems:
/usr/local/lib/ruby/gems/1.8/doc/*/ri
[...]
Options may also be passed in the 'RI' environment variable
$
I've set my RI environment variable is -T -f ansi to turn off the pager and give me fancy colors, but you can do mix-and-match options to your liking. To only search the system libraries by default, export RI='--system'. To make an alias that searches only rails documentation:
(If you have multiple rails versions you'll need to explicitly list the versions of each gem.)
$ rri ActiveRecord::Base.find
----------------------------------------------- ActiveRecord::Base::find
ActiveRecord::Base::find(*args)
------------------------------------------------------------------------
Find operates with three different retrieval approaches:
[...]
Also, note that if you install multiple versions of a gem you'll either need to run gem cleanup and remove the old versions or manually remove their ri if you want the older versions to hang around. If you don't, you might get duplicate documentation.