Skip to Content
Ruby Pocket Reference
book

Ruby Pocket Reference

by Michael Fitzgerald
July 2007
Beginner to intermediate
176 pages
2h 30m
English
O'Reilly Media, Inc.
Content preview from Ruby Pocket Reference

Ruby Documentation

Ruby documentation refers to the documentation generated by RDoc (http://rdoc.sourceforge.net), a program that extracts documentation from Ruby source files, both from C and Ruby files.

The documentation is stored in comments in the source files and encoded so that RDoc can easily find it. RDoc can generate output as HTML, XML, ri (Ruby information), or Windows help (chm) files.

To see the RDoc-generated HTML documentation for Ruby, go to http://www.ruby-doc.org/core. If you have Ruby documentation installed on your system, which you likely do if you followed the installation instructions earlier in the book, you can type something like the following at a shell prompt to get formatted documentation in return. Type:

ri Kernel.print

and you will get this output:

----------------------------------------------------------- Kernel#print
     print(obj, ...)    => nil
------------------------------------------------------------------------
     Prints each object in turn to +$stdout+. If the
output field
     separator (+$,+) is not +nil+, its contents will
appear between
     each field. If the output record separator (+$\+) is
not +nil+, it
     will be appended to the output. If no arguments are
given, prints
     +$_+. Objects that aren't strings will be converted
by calling
     their +to_s+ method.

        print "cat", [1,2,3], 99, "\n"
        $, = ", "
        $\ = "\n"
        print "cat", [1,2,3], 99

     _produces:_

        cat12399
        cat, 1, 2, 3, 99

Here are the RDOC formatting basics:

  • Paragraphs in comments become paragraphs in the documentation. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Ruby Pocket Reference, 2nd Edition

Ruby Pocket Reference, 2nd Edition

Michael Fitzgerald
Ruby Phrasebook

Ruby Phrasebook

Jason Clinton
Ruby by Example

Ruby by Example

Kevin C. Baird

Publisher Resources

ISBN: 9780596514815Errata Page