With good ri, easy access to ruby / rails document

RI is a ruby the document inspection tool, unix effect similar to the man, it can be used to view the documentation of classes and methods using ruby rdoc written format. Ri previously did not use good, because I think at the outset using ri check things out always incomplete, for example, want to check the method File.move to move the file but could not get the correct description of the File class, but some gem offers File extensions of the methods explained, so he had the presence of html form of ruby rdoc browser bookmarks, open the relevant page of the query by the browser when the need to consult, such efficiency is too low, and very tedious, if good use of the RI, we can easily find the need to refer to the description of all classes and methods, even the rails of the API.

The first point is to install the correct documentation rdoc good ruby basic library system, such as compiled from the source code, then we should 'make install-doc', if it is installed bundles through linux, for example, I use the gentoo then make sure you USE in with the doc variable.
Once properly installed, the basic class library can be found.

Second, if the mounting rails, you can use the command to generate a gem rdoc --all rdoc all the gems.

When using ri, remember "::" is a class method delimiter "#" is an example of a method of the separator, and '.' Separator is two can.
To begin with a capital letter when looking for class, method to find places lowercase letters start. For example:
RI # Find File Class File
RI move move lookup method #

Note that if the method name contains symbols need in quotes, or escape:

    '. The Array []' RI
    RI Compact /!



    /usr/share/ri/1.8/system
    /usr/share/ri/1.8/site
    /home/yangbo/.rdoc
    /usr/lib/ruby/gems/1.8/doc/*/ri
Published 46 original articles · won praise 7 · views 80000 +

Guess you like

Origin blog.csdn.net/yangbo_hr/article/details/2026216