How to quickly lookup Ruby documentation

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.

Sajad Torkamani

Hello! My name is Sajad. I’m a software developer at Nationwide and an aspiring entrepreneur. Originally from Afghanistan, I moved to London at an early age and have been living here for the past 20 years.

This is my personal website where I blog mostly about programming with occasional thoughts on a bunch of other things. I write mainly for my own benefit as I find that writing helps clarify my otherwise very confused thoughts.

Get in touch: sajadtorkamani1@gmail.com