accessing ruby standard library documentation locally accessing ruby standard library documentation locally ruby ruby

accessing ruby standard library documentation locally


In your terminal, you can use ri to print specific parts of the documentation. (Note that if you're using RVM to manage your ruby installation(s), you may need to run rvm docs generate to avoid getting "Nothing known about...." responses)

For example:

> ri Array#drop

would output:

------------------------------------------------------------- Array#drop     ary.drop(n)               => array------------------------------------------------------------------------     Drops first n elements from _ary_, and returns rest elements in an     array.        a = [1, 2, 3, 4, 5, 0]        a.drop(3)             # => [4, 5, 0]


Several options:


Devdocs does the job

  • it works (also) offline
  • it is not limited to the ruby doc ;)

Clone the repo from github:

git clone git@github.com:Thibaut/devdocs.gitcd devdocs

Install dependencies:

gem install bundlerbundle install

download the docs:

thor docs:download --all

Run it:

rackup

It's accessible by default at http://localhost:9292