small medium large xlarge

Errata for Programming Ruby 1.9 & 2.0 (4th edition)

 

The latest version of the book is P2.0, released about 2 years ago. If you've bought a PDF of the book and would like to upgrade it to this version (for free), visit your home page.

By default this page displays the errata for the latest version of the book. If you have a previous version, select it here:

If you've found a new error, please submit it.

  • Typo
  • Tech. error
  • Suggestion
  • Maybe next edition
  • Not a problem
  • Reported in: P2.0 (31-Oct-14)
#77747
PDF page: pre
The preface page says 'P2.0 - December 2013' but the timestamp is mars 27 and that is also what is used in pragmatic bookshelf. The bookshelf also add...more...
  • Reported in: P2.0 (29-Sep-14)
#77510
PDF page: n/a
In Chapter 27 under "Alphabetical Listing", the entries all run into each other with no spaces inbetween and no formatting. Also, some of the detailed...more...
  • Reported in: P1.0 (13-Mar-14)
#76532
PDF page: xi
Remove the Forward to the 3rd edition. It makes the 1.9/2.0 version which is 4th ed appear to be the 3rd edition and confuses customers. Especially st...more...
  • Reported in: P2.0 (02-Feb-15)
#78138
PDF page: 0

Enumerators aren't mentioned at all in Part 3 Ruby Crystalized.2

  • Reported in: P1.0 (02-Feb-14)
#76356
PDF page: 5

"... is Luis Lavena's RubyInstaller.org." ->

"... is Luis Lavena's RubyInstaller."--Jon Forrest

  • Reported in: P1.0 (16-Nov-13)
#53158
Paper page: 11

"(To get a list of classes with ri documentation, type
ri with no arguments.)"
Isn't that what -l (--list) switch is for?--Anatoly Kamchatnov

  • Reported in: P2.0 (12-Sep-14)
#77317
Paper page: 16
The example line 11 from the bottom will NOT produce the output in line 6 from the bottom. The output will be an error. This might confuse reader new ...more...
  • Reported in: P2.0 (07-Apr-15)
#78284
PDF page: 28
In section 2.9 Command Line Arguments it would be a good idea to clearly explain the (somewhat) counter intuitive behaviour of gets when command line ...more...
  • Reported in: P2.0 (14-Aug-14)
#77215
Paper page: 32

In BookStock the method to_s is defined but not called. --Cristina Atx

  • Reported in: P2.0 (15-Mar-16)
#80105
PDF page: 34
In the Java example of the setter function, you write b = new BookInStock(... This is a syntax error unless b having been declared before and it's...more...
  • Reported in: P2.0 (19-May-15)
#78442
Paper page: 36

In the def statement for the price_in_cents method, price should be @price--Michael Hodgins

  • Reported in: P2.0 (03-May-14)
#76765
PDF page: 44
Chapter 3 says the following: We still have to look at class methods and at concepts such as mixins and inheritance. We’ll do that in Chapter 5, Shari...more...
  • Reported in: P2.0 (23-Jan-15)
#78079
Paper page: 45
the example presents the contents of 'b' at the end. I'd like to see the contents of 'a' as well, in order to see that the access of a[3] did or did ...more...
  • Reported in: P1.0 (04-Jun-14)
#76837
PDF page: 47
Similarly, unshift and shift add and remove elements from the head of an array. Combine shift and push, and you have a first-in first-out (FIFO) queu...more...
  • Reported in: P2.0 (08-Jun-15)
#78474
PDF page: 47
In the last paragraph of section 4.1, there are no spaces around the word "Array" in the sentence: "The reference section lists the methods in classAr...more...
  • Reported in: P2.0 (08-Jun-15)
#78475
PDF page: 48
Around the middle of the page there are no spaces around the word "Hash" in the sentence "The reference section has a list of the methods implemented ...more...
  • Reported in: P2.0 (07-Apr-15)
#78285
PDF page: 50
The result from the word frequency program shown on page 50 should be: for: 2 word: 2 use: 2 the: 3 a: 6 This is consistent with t...more...
  • Reported in: P2.0 (08-Sep-15)
#78805
Paper page: 53
This is the first 'error' I have found and most likely due to the changes in Ruby (I am running ruby 2.0.0p645 (2015-04-13 revision 50299) [x86_64-dar...more...
  • Reported in: P2.0 (12-Apr-15)
#78309
PDF page: 59
Paper page: 45
In the statement "The class Array holds a collection of object references. Each object reference occupies a position in the array, identified by a non...more...
  • Reported in: P1.0 (17-Feb-14)
#76433
PDF page: 62
I have following version of ruby. asang@speedy ruby]$ ruby -v ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux] When I try using Intege...more...
  • Reported in: P2.0 (15-May-14)
#76797
PDF page: 64

It would be more consistent to either say 0..4 or 0...5 as what is referenced on page 66 doesn't match what is on page 64 (in the for loop).

  • Reported in: P2.0 (22-Aug-15)
#78776
PDF page: 72

Update:
GServer is discontinued as part of the Std. Lib. and must be installed as a gem.--Peter Vitting

  • Reported in: P1.0 (09-Nov-14)
#77790
PDF page: 84

2nd line of Rational example should show result # => (1/3)

  • Reported in: P2.0 (28-Mar-14)
#76576
PDF page: 90
In the following code on page 90: class Person include Comparable attr_reader :name def initialize(name) @name = name end def to_s "#{@name}...more...
  • Reported in: P2.0 (05-May-14)
#76767
PDF page: 103
I put "typo" but I'm not sure its a typo. For \s, the first line is: (?a), (?d) → [␣\t\r\n\f] (?a), (?d) → [0-9] I get this much: (?a), (?d) → ...more...
  • Reported in: P2.0 (27-Jan-15)
#78089
Paper page: 108
since we are using /x for the last 're' on the page, it would be nice to include a comment that we are fishing for literal '{' and '}' characters on t...more...
  • Reported in: P1.0 (15-Nov-13)
#53155
PDF page: 114
In "Table 2—Character class abbreviations" \s Whitespace (?a), (?d) → [␣\t\r\n\f] (?a), (?d) → [0-9] This seems to be suggesting that `\s...more...
  • Reported in: P2.0 (08-Jul-14)
#76972
Paper page: 122
"You can place key => value pairs in an argument list, as long as they follow any normal arguments and precede any splat and block arguments." I th...more...
  • Reported in: P2.0 (06-Feb-15)
#78155
PDF page: 150
raise ArgumentError, "Name too big", caller[1..-1] we think the range at the end should be [1...-1], in other words, 3 dots, not two. The accompa...more...
  • Reported in: P2.0 (28-Jan-15)
#78102
Paper page: 152
When describing what happens with a second parameter for 'throw', this phrase implies we have already seen or learned about a second parameter: "If t...more...
  • Reported in: P2.0 (29-Jan-15)
#78124
Paper page: 192

typo: context "and the oponent wins a point" do
s/oponent/opponent/

  • Reported in: P2.0 (27-Mar-15)
#78280
Paper page: 199

typo: "This may be incompatibile with older code."
s/incompatibile/incompatible/

  • Reported in: P2.0 (29-Jan-15)
#78125
Paper page: 213

Typo: At some point, when you finishing reading from the last file,
s/finishing/finish/

  • Reported in: P1.0 (31-Jan-14)
#76355
PDF page: 298

Unlike their lowercase counterparts, %I, %Q, and %W will preform interpolation:

should be 'perform'--Patrick Neve

  • Reported in: P2.0 (15-Nov-14)
#77807
PDF page: 301

classStringon page 666.
The Basic Types • 301
Rather, 'class String on page...'--michael cannon

  • Reported in: P2.0 (08-Dec-15)
#79306
PDF page: 312

On Table 14, "\#{code}" should be "#{code}".

  • Reported in: P2.0 (06-May-14)
#76770
PDF page: 316
The information under "Regular Expression Patterns" (under "The Basic Types" under chapter 22 "The Ruby Language" should be a table. Also, there shou...more...
  • Reported in: P1.0 (06-Mar-14)
#76489
Paper page: 320
The description of Ranges in Boolean Expressions contains errors, is confusing, and really ought to be rewritten! Both the logic of this expression a...more...
  • Reported in: P2.0 (08-Nov-15)
#79130
PDF page: 325
The following is an error: def meth(first = 12, second, third = 13) ... end It appears that the optional arguments may be at the front, midd...more...
  • Reported in: P2.0 (08-Dec-15)
#79307
PDF page: 332

Under "Ranges in Boolean Expressions", expr2 is not shown in the code example. It probably should be "expr1 .. expr2".

  • Reported in: P2.0 (08-Dec-15)
#79308
PDF page: 332

On "Ranges in Boolean Expressions", point 2.

"if expr2 is not true" should be "if expr2 is true".--Hendy Tanata

  • Reported in: B2.0 (09-Feb-14)
#76394
PDF page: 338
Private methods therefore can be called in the defining class and by that class’s descendents and ancestors, but only within the same object. I thi...more...
  • Reported in: P2.0 (24-Mar-15)
#78275
Paper page: 383

"on page 375" should be "on page 376"
(first line after Hook Methods)

  • Reported in: P2.0 (15-Apr-14)
#76663
Paper page: 429
Chapter 27's coverage of the Array class is missing ".include?", and the index for ".include?" also doesn't mention that it applies to arrays.--Ken Eb...more...
  • Reported in: P1.0 (25-Dec-13)
#57977
Paper page: 438

Sample invocation of Array#unshift contains a right curly brace that should be left out.--Meindert Meindertsma

  • Reported in: P2.0 (26-Nov-14)
#77848
PDF page: 453
Method overview for eql? for the class Complex should have a ? in it: it reads: complex.eql( other ) → true or false but should read: complex.eql...more...
  • Reported in: P2.0 (05-Feb-15)
#78150
PDF page: 473
Paper page: 473
In description of "one?", change "at least" to "exactly" (or similar). "(that is, one? will return true if {exactly}[at least] one of the collectio...more...
  • Reported in: P2.0 (26-Jan-16)
#79706
PDF page: 474
The last line on the page reads [["colors", " red", " yellow", "pitches", " high", " low", " middle"]] It should read: [["colors", " red", " ...more...
  • Reported in: P1.0 (21-Jan-14)
#76320
PDF page: 585

The example code in Module#prepend documentation is truncated.--Rafal Rzepecki

  • Reported in: P2.0 (25-Feb-16)
#80005
PDF page: 588

In class Mutex, all methods are marked as "New in 2.0". In fact, all of them are present already in 1.9.3.--Ronald Fischer

  • Reported in: P2.0 (23-Jan-15)
#78078
PDF page: 742
not exactly a bug, but messy: the example used for documenting CSV on p 742 prints out table contents where the values don't line up exactly. The "H...more...
  • Reported in: P1.0 (05-Dec-13)
#53282
PDF page: 763

"when the file cn be read or written" -> "when the file can be read or written"--Graham Menhennitt

  • Reported in: P2.0 (10-Jul-14)
#76986
Paper page: 808
The last sentence of the leading paragraph of the Standard Library description for StringIO on p.808 should read: StringIO objects take their encod...more...