A short howto on creating a working offline Ruby documentation, including the ruby-core and stdlib, using the YARD gem. The original post here is 3 years old, and it was missing some instructions that took me 30 minutes googling and documentation reading.

I chose to generate the offline documentation from the Ruby source code itself. YARDoc can generate HTML pages along its own document format so you can decide in what format you want to browse the Ruby document pages. The OS is Linux and I have the most recent stable Ruby version (2.0.0-p247).

Install YARD:

$ gem install yard

Download the Ruby language source code and extract it (mine is ruby-2.0.0-p247 MRI but can be any version, although documentation quality might vary):

$ wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
$ tar xzvf ruby-2.0.0-p247.tar.gz
$ cd ruby-2.0.0-p247

Build the core documentation:

$ yardoc *.c

YARDoc will create a ".yardoc" folder by default (surprise!), that contains the YARD format and a "doc" folder where it puts the HTML pages.

$ yardoc -b .yardoc-stdlib -o doc-stdlib

Here YARDoc will create a ".yardoc-stdlib" folder for its own format and a "doc-stdlib" for the HTML pages. And we're done!

Now you can go into one of those HTML folders and load 'index.html' into your browser, however index.html is not the real starting page for the framed version you might got used to. Index.html starts with a japanese language page where you need to click "Index" or "frames" to get to the familiar looking RubyDoc pages.

Or, let's start the YARD server:

$ yard server -m ruby-core2.0 .yardoc stdlib .yardoc-stdlib

"-m" tells YARD to load multiple documents, "ruby-core2.0" and "stdlib" are just screen names. Navigate your browser to http://localhost:8808 and you will see them popping up in a list.

Happy browsing offline.