<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Segment7: Unleashing ri</title>
    <link>http://blog.segment7.net/articles/2006/08/27/unleashing-ri</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>The Blog</description>
    <item>
      <title>Unleashing ri</title>
      <description>Now that &lt;a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/210528"&gt;ruby 1.8.5 has been released&lt;/a&gt; (&lt;a href="http://eigenclass.org/hiki.rb?ruby+1.8.5+changelog"&gt;Changelog&lt;/a&gt;) and ri includes a bunch more documentation and integrates with gems you just might be suffering from ri overload.

&lt;pre&gt;&lt;samp&gt;$ ri --system -l | wc -l
    8882
$ ri -l | wc -l
   11918
$ echo 11918 - 8882 | bc
3036&lt;/samp&gt;&lt;/pre&gt;

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.

&lt;pre&gt;&lt;samp&gt;$ ri -h
[...]

  --doc-dir, -d &amp;lt;dirname&amp;gt;
                  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
$&lt;/samp&gt;&lt;/pre&gt;

I've set my RI environment variable is &lt;samp&gt;-T -f ansi&lt;/samp&gt; 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, &lt;kbd&gt;export RI='--system'&lt;/kbd&gt;.  To make an alias that searches only rails documentation:

&lt;pre&gt;&lt;kbd&gt;alias rri="ri -d /usr/local/lib/ruby/gems/1.8/doc/actionmailer*/ri \
              -d /usr/local/lib/ruby/gems/1.8/doc/actionpack*/ri \
              -d /usr/local/lib/ruby/gems/1.8/doc/actionwebservice*/ri \
              -d /usr/local/lib/ruby/gems/1.8/doc/activerecord*/ri \
              -d /usr/local/lib/ruby/gems/1.8/doc/activesupport*/ri \
              -T -f ansi"&lt;/kbd&gt;&lt;/pre&gt;

(If you have multiple rails versions you'll need to explicitly list the versions of each gem.)

&lt;pre&gt;&lt;samp&gt;$ rri ActiveRecord::Base.find
----------------------------------------------- ActiveRecord::Base::find
     ActiveRecord::Base::find(*args)
------------------------------------------------------------------------
     Find operates with three different retrieval approaches:

[...]&lt;/samp&gt;&lt;/pre&gt;

Also, note that if you install multiple versions of a gem you'll either need to run &lt;kbd&gt;gem cleanup&lt;/kbd&gt; 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.
</description>
      <pubDate>Sun, 27 Aug 2006 16:45:00 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:1bd1c597-c4ef-41fa-a903-33cd25f81f20</guid>
      <author>drbrain@segment7.net (Eric Hodel)</author>
      <link>http://blog.segment7.net/articles/2006/08/27/unleashing-ri</link>
      <category>RDoc</category>
      <category>Ruby</category>
    </item>
  </channel>
</rss>
