small medium large xlarge

Programming Ruby 1.9 (3rd edition): The Pragmatic Programmers' Guide


Cover image for Programming Ruby 1.9

Programming Ruby 1.9 (3rd edition)

The Pragmatic Programmers' Guide


Ruby is the fastest growing and most exciting dynamic language out there. If you need to get working programs delivered fast, you should add Ruby to your toolbox.

This book has been superseded.
Please see the Fourth Edition for Ruby 1.9 and 2.0, or the original PickAxe for 1.8.

About this Title

Pages: 944
Published: 2009-04-15
Release: P5.0 (2012-10-16)
ISBN: 978-1-93435-608-1

Would you like to go from first idea to working code much, much faster? Do you currently spend more time satisfying the compiler instead of your clients or end users? Are you frustrated with demanding languages that seem to get in your way, instead of getting the work done? Are you using Rails, and want to dig deeper into the underlying Ruby language? If so, then we’ve got a language and book for you!

Ruby is a fully object-oriented language, much like the classic object-oriented language, Smalltalk. Like Smalltalk, it is dynamically typed (as opposed to Java or C++), but unlike Smalltalk, Ruby features the same conveniences found in modern scripting languages such as Perl and Python.

The combination of the power of a pure object-oriented language with the convenience of a scripting language makes Ruby a favorite tool of intelligent, forward-thinking programmers.

The Pickaxe contains four major sections:

  • An acclaimed tutorial on using Ruby.
  • The definitive reference to the language.
  • Complete documentation of all built-in classes, modules, and methods.
  • Complete descriptions of all 97 standard libraries.

This is the reference manual for Ruby, including a description of all the standard library modules, a complete reference to all built-in classes and modules (including all the new and changed methods introduced by Ruby 1.9, 1.9.2, and 1.9.3¹). It also includes all the new and changed syntax and semantics introduced since Ruby 1.8. Learn about the new parameter passing rules, local variable scoping in blocks, fibers, and the new block declaration syntax, among other exciting new features.

For the Tenth Anniversary Printing, we’ve removed the appendices on Extending Ruby and the Socket Library from the book—it was getting too big, and those appendices were only used by a few readers. These appendices are now available for free in PDF, mobi, and epub formats—see the contents listing below.

What You Need

  • This book assumes you have a basic understanding of object-oriented programming.
  • In general, Ruby programmers tend to favor the the command line for running their code, and they tend to use text editors rather than IDEs.
  • Ruby runs on Windows, Linux, and Macs.

Contents & Extracts

  • Facets of Ruby
    • Getting Started
    • Classes, Objects, and Variables
    • Containers, Blocks, and Iterators
    • Sharing Functionality: Inheritance, Modules, and Mixins
    • Standard Types
    • Regular Expressions (download pdf)
    • More About Methods
    • Expressions
    • Exceptions, catch, and throw
    • Basic Input and Output
    • Fibers, Threads, and Processes
    • Unit Testing
    • When Trouble Strikes!
  • Ruby in Its Setting
    • Ruby and Its World
    • Namespaces, Source Files, and Distribution (download pdf)
    • Character Encoding
    • Interactive Ruby Shell
    • Documenting Ruby
    • Ruby and the Web
    • Ruby and Microsoft Windows
  • Ruby Crystallized
    • The Ruby Language
    • Duck Typing
    • Metaprogramming
    • Reflection, ObjectSpace, and Distributed Ruby
    • Locking Ruby in the Safe
  • Ruby Library Reference
    • Built-in Classes and Modules (download pdf of the entry for class Array)
    • Standard Library
  • Free Content
    • Extending Ruby
    • The Socket API


Dave Thomas is a cornerstone of the Ruby community, and is personally responsible for many of its innovative directions and initiatives. He and original co-author Andy Hunt are founders of the Pragmatic Programmers and the Pragmatic Bookshelf. Chad Fowler is co-director of Ruby Central, Inc., and remains an active, driving force in the Ruby community.