Today I Learned

hashrocket A Hashrocket project

Use ri to Lookup Ruby Docs from the Command Line

Did you know you can look up ruby documentation on Classes and methods from the command line? The slightly elusive ri command does just that. You can pass it an argument of the class/method you want to look up, or you can enter interactive mode without arguments.

$ ri uniq

$ ri Array#compact

$ ri Hash

You can also use it to browse all the pre-defined ruby global variables:

$ ri ruby:globals

Check out the docs or run ri --help to see all it can do.

h/t Brian Dunn

See More #ruby TILs
Looking for help? Each developer at Hashrocket has years of experience working with Ruby applications of all types and sizes. We're an active presence at Ruby conferences, have written some of the most popular gems, and have worked on many of the web's Ruby on Rails success stories. Contact us today to talk about your Ruby project.