The Ruby Programming Language [NOOK Book]


The Ruby Programming Language is the authoritative guide to Ruby and provides comprehensive coverage of versions 1.8 and 1.9 of the language. It was written (and illustrated!) by an all-star team:

  • David Flanagan, bestselling author of programming language "bibles" (including JavaScript: The Definitive Guide and Java in a Nutshell) and committer to the Ruby Subversion ...
See more details below
The Ruby Programming Language

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$17.99 price
(Save 43%)$31.99 List Price


The Ruby Programming Language is the authoritative guide to Ruby and provides comprehensive coverage of versions 1.8 and 1.9 of the language. It was written (and illustrated!) by an all-star team:

  • David Flanagan, bestselling author of programming language "bibles" (including JavaScript: The Definitive Guide and Java in a Nutshell) and committer to the Ruby Subversion repository.

  • Yukihiro "Matz" Matsumoto, creator, designer and lead developer of Ruby and author of Ruby in a Nutshell, which has been expanded and revised to become this book.

  • why the lucky stiff, artist and Ruby programmer extraordinaire.
This book begins with a quick-start tutorial to the language, and then explains the language in detail from the bottom up: from lexical and syntactic structure to datatypes to expressions and statements and on through methods, blocks, lambdas, closures, classes and modules.

The book also includes a long and thorough introduction to the rich API of the Ruby platform, demonstrating -- with heavily-commented example code -- Ruby's facilities for text processing, numeric manipulation, collections, input/output, networking, and concurrency. An entire chapter is devoted to Ruby's metaprogramming capabilities.

The Ruby Programming Language documents the Ruby language definitively but without the formality of a language specification. It is written for experienced programmers who are new to Ruby, and for current Ruby programmers who want to challenge their understanding and increase their mastery of the language.

Read More Show Less

Product Details

  • ISBN-13: 9780596554651
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 1/25/2008
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 448
  • Sales rank: 591,737
  • File size: 5 MB

Meet the Author

David Flanagan is a computer programmer who spends most of his time writing about JavaScript and Java. His books with O'Reilly include JavaScript: The Definitive Guide, JavaScript Pocket Reference, Java in a Nutshell, Java Examples in a Nutshell, and Java Foundation Classes in a Nutshell. David has a degree in computer science and engineering from the Massachusetts Institute of Technology. He lives with his wife and children in the U.S. Pacific Northwest bewteen the cities of Seattle, Washington and Vancouver, British Columbia. David has a blog at

Yukihiro Matsumoto ("Matz"), the creator of Ruby, is a professional programmer who worked for the Japanese open source company, Matz is also known as one of the open source evangelists in Japan. He's released several open source products, including cmail, the emacs-based mail user agent, written entirely in emacs lisp. Ruby is his first piece of software that has become known outside of Japan.

Read More Show Less

Table of Contents


1 Introduction 1

1.1 A Tour of Ruby 2

1.2 Try Ruby 11

1.3 About This Book 15

1.4 A Sudoku Solver in Ruby 17

2 The Structure and Execution of Ruby Programs 25

2.1 Lexical Structure 26

2.2 Syntactic Structure 33

2.3 File Structure 35

2.4 Program Encoding 36

2.5 Program Execution 39

3 Datatypes and Objects 41

3.1 Numbers 42

3.2 Text 46

3.3 Arrays 64

3.4 Hashes 67

3.5 Ranges 68

3.6 Symbols 71

3.7 True, False, and Nil 72

3.8 Objects 72

4 Expressions and Operators 85

4.1 Literals and Keyword Literals 86

4.2 Variable References 87

4.3 Constant References 88

4.4 Method Invocations 89

4.5 Assignments 92

4.6 Operators 100

5 Statements and Control Structures 117

5.1 Conditionals 118

5.2 Loops 127

5.3 Iterators and Enumerable Objects 130

5.4 Blocks 140

5.5 Altering Control Flow 146

5.6 Exceptions and Exception Handling 154

5.7 BEGIN and END 165

5.8 Threads, Fibers, and Continuations 166

6 Methods, Procs, Lambdas, and Closures 175

6.1 Defining Simple Methods 177

6.2 Method Names 180

6.3 Methods and Parentheses 183

6.4 Method Arguments 185

6.5 Procs and Lambdas 192

6.6 Closures 200

6.7 Method Objects 203

6.8 Functional Programming 205

7 Classes and Modules 213

7.1 Defining a Simple Class 214

7.2 Method Visibility: Public, Protected, Private 232

7.3 Subclassing and Inheritance 234

7.4 Object Creation and Initialization 241

7.5 Modules 247

7.6 Loading and Requiring Modules 252

7.7 Singleton Methods and the Eigenclass 257

7.8 Method Lookup 258

7.9 Constant Lookup 261

8 Reflection and Metaprogramming 265

8.1 Types, Classes, and Modules 266

8.2 Evaluating Strings and Blocks268

8.3 Variables and Constants 271

8.4 Methods 272

8.5 Hooks 277

8.6 Tracing 279

8.7 ObjectSpace and GC 281

8.8 Custom Control Structures 281

8.9 Missing Methods and Missing Constants 284

8.10 Dynamically Creating Methods 287

8.11 Alias Chaining 290

8.12 Domain-Specific Languages 296

9 The Ruby Platform 303

9.1 Strings 304

9.2 Regular Expressions 310

9.3 Numbers and Math 321

9.4 Dates and Times 325

9.5 Collections 328

9.6 Files and Directories 350

9.7 Input/Output 356

9.8 Networking 366

9.9 Threads and Concurrency 372

10 The Ruby Environment 389

10.1 Invoking the Ruby Interpreter 390

10.2 The Top-Level Environment 394

10.3 Practical Extraction and Reporting Shortcuts 403

10.4 Calling the OS 405

10.5 Security 409

Index 413

Read More Show Less

Customer Reviews

Average Rating 5
( 4 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 4 Customer Reviews
  • Anonymous

    Posted December 10, 2012

    No text was provided for this review.

  • Anonymous

    Posted June 30, 2011

    No text was provided for this review.

  • Anonymous

    Posted December 12, 2011

    No text was provided for this review.

  • Anonymous

    Posted April 26, 2011

    No text was provided for this review.

Sort by: Showing all of 4 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)