8
votes

I've never seen the point of installing the ri and rdoc for gems and my .gemrc file has --no-ri and --no-rdoc set. Since every gem includes ri and rdoc info, I just wondered if I'm missing something? Is there any advantage to installing the ri and rdoc for a gem?

Thanks

Chris

Summary

If you don't install the ri and rdoc, you don't lose anything of great value. I thought perhaps it got used in some of the IDEs (I'm an Emacs user) but that doesn't seem to be the case.

4

4 Answers

13
votes

The point of installing ri documentation is simply that you can use the "ri" command to access method-by-method documentation. For an example, try: "ri String#reverse". Exit by pressing "q".

To try out RDoc documentation, run "gem server" and then connect to localhost:8808 in your browser. I find it useful - you can even click on a method name to see the source code. Of course, you can just go into your gems folder and open the HTML files in the doc folder.

An alternate way to access RDoc is the gemdoc command. See http://www.stephencelis.com/2008/06/12/bashfully-yours-gem-shortcuts.html. That's quite handy, IMHO.

Anyway, you can be lazy and wait until you need the RDoc documentation, and then generate it with "gem rdoc ".

3
votes

Personally, I'm installing my gems without rdoc and ri, too, because normally you can find all the documentation you need on the internet as well (i.e. www.rdoc.info), so there's no need for investing hard disk space and time the generation takes

2
votes

Install it if you want locally available documentation for the gem.

0
votes

This article gives a great why and how of using ri:

http://jstorimer.com/ri.html

Best point on that list is #1: ri understands Ruby. For instance:

$ ri ActiveRecord::Base#save
(from gem activerecord-3.2.8)
Implementation from ActiveRecord::Persistence

[...]

(from gem activerecord-3.2.8)
Implementation from ActiveRecord::Validations

[...]

Notice the method is found even if not directly on ActiveRecord::Base itself.