Quicky look up Ruby documentation from the terminal

Aug 24, 2020

Instead of opening up the Ruby Docs in a web page like this, we can use the ri (Ruby Index) command-line tool to quickly lookup the documentation for a Ruby method, class or module.

ri File.open # View docs for method
ri File # View docs for class
ri Enumerable # View docs for module

Ruby is a very rich language with lots of built-in methods so being able to quickly look up the docs for its various methods saves a lot of time.

ri should be installed automatically when you install Ruby itself.