small medium large xlarge

Errata for Programming Ruby 1.9 (3rd edition)

 

The latest version of the book is P5.0, released about 4 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: P5.0 (05-Mar-13)
#50957
PDF page: 9

Website for RVM lists old one: beginrescueend.com instead of new one rvm.io--David Acevedo

  • Reported in: P4.1 (23-Jun-12)
#49454
PDF page: 20

The example for accept_loop has nothing to do with accept_loop and is, in fact, the same as the example for getaddrinfo--Greg Stearns

  • Reported in: P4.1 (23-Jun-12)
#49455
PDF page: 26
Note: this erratum is only for the Socket Library appendix, though the report link directs here. the ipv6only! method is misspelled in different wa...more...
  • Reported in: P5.0 (22-Aug-13)
#52434
PDF page: 38
inst_section={ cello: 'string', clarinet:'woodwind', drum: 'percussion', oboe: 'woodwind', trumpet: 'brass', violin: 'string' } this code in...more...
  • Reported in: P5.0 (09-Jul-13)
#52153
PDF page: 48

On Page number 48, you've given an example of each where 'e' is shown. BTW: each excludes last thing.--Pratik

  • Reported in: P5.0 (08-Dec-12)
  • Fixed: 20-Feb-13, awaiting book release
#50346
PDF page: 50
The use of the exclusive range operator had me thinking there was a typo/off-by-one error. After messing with it in irb, I understand how it works. a ...more...
  • Reported in: P5.0 (29-Jan-13)
  • Fixed: 20-Feb-13, awaiting book release
#50607
PDF page: 60
In general the path:"samples" is wrong, dont exist in the zip file. In this case: samples/book_in_stock.rb the correct path is: code/tut_classes/st...more...
Dave Thomas says: I don't see this in my edition
  • Reported in: P4.2 (23-Aug-12)
  • Fixed: 20-Feb-13, awaiting book release
#49728
PDF page: 83

third last line should be
0o377 => 255
instead of
0377 => 255--Widu Wittekindt

Dave Thomas says: I believe it is correct as it stands
  • Reported in: P5.0 (19-Apr-13)
#51340
Paper page: 99
show_regexp(a, /[\d\-]/) # => see [The PickAxe->-<-page 123] Actually this returns "no match" because the regex is looking for a digit followed by ...more...
  • Reported in: P4. (31-Mar-14)
#76591
Paper page: 124
The text reads, "You can place key => value pairs in an argument list, as long as they follow any normal arguments and precede any splat and block arg...more...
  • Reported in: P4. (31-Mar-14)
#76592
PDF page: 140

Recardin the previus commmenters corexion, "shoule" should be spelt "should". :)

  • Reported in: P5.0 (18-Oct-12)
  • Fixed: 20-Feb-13, awaiting book release
#49955
PDF page: 145
In the first example of 10.4 catch and throw (bottom of page), you have; puts result.reverse Should that not be; puts result.sort.reverse--Mi...more...
Dave Thomas says: I think it is OK—it prints the words in the reverse order to that in which they were added.
  • Reported in: P5.0 (19-Oct-12)
  • Fixed: 20-Feb-13, awaiting book release
#49960
PDF page: 154
11.5 Parsing HTML The Hpricot GEM is no longer maintained (github.com/hpricot), perhaps this section should be updated to use an alternative, or re...more...
  • Reported in: P5.0 (16-Nov-12)
  • Fixed: 20-Feb-13, awaiting book release
#50172
PDF page: 157
In the "Creating Ruby Threads" section, the first example iterates over the "page" variable when it should uses "pages" as defined earlier.--Joseph Cr...more...
  • Reported in: P5.0 (16-Jan-13)
  • Fixed: 20-Feb-13, awaiting book release
#50469
PDF page: 163
The hypothetical currency converter example, the ensure clause must be inside a begin... end. begin puts(exchange_rates.convert(line)) ensure ...more...
Dave Thomas says: It's OK as it stands—method bodies are automatically exception handlers.
  • Reported in: P4.2 (05-Oct-12)
  • Fixed: 20-Feb-13, awaiting book release
#49921
PDF page: 224
test in book is: context "specifying words and a dictionary" do should "return the words" do opts = Anagram::Options.new(["-d", "mydict", "word1"...more...
Dave Thomas says: I believe it is correct as it stands
  • Reported in: P5.0 (03-Dec-12)
  • Fixed: 20-Feb-13, awaiting book release
#50244
PDF page: 232

In the parenthetical sentence about half-way down the page, remove the comma from "another, significant use".--Joseph Crail

  • Reported in: P4.2 (29-Jul-12)
  • Fixed: 20-Feb-13, awaiting book release
#49596
PDF page: 308
Please follow the discussion here: bugs.ruby-lang.org/issues/6810 to see how it turns out. For me, this is a rather fundamental change in how I view ...more...
  • Reported in: P5.0 (03-Dec-12)
  • Fixed: 20-Feb-13, awaiting book release
#50243
PDF page: 350

In the first line of the last paragraph, change "practic" to "practice".--Joseph Crail

  • Reported in: P4.2 (11-Aug-12)
  • Fixed: 20-Feb-13, awaiting book release
#49640
PDF page: 370
I do not get the expected output ("Dave lives in Texas and likes Programming Languages") for the example in the page. 1.9.3p194 :005 > class Person...more...
Dave Thomas says: Looks like you already had a Person class defined
  • Reported in: P5.0 (19-Oct-12)
  • Fixed: 20-Feb-13, awaiting book release
#49964
PDF page: 529
Under the documentation for IO.binwrite, it says: "options is an optional hash used to pass parameters to the underlying open call used by read." ...more...
  • Reported in: P5.0 (21-Oct-12)
  • Fixed: 20-Feb-13, awaiting book release
#49967
PDF page: 545

IO#set_encoding takes an options argument for specifying encoding behavior.--Brian Ford

  • Reported in: P5.0 (07-Feb-13)
  • Fixed: 20-Feb-13, awaiting book release
#50760
PDF page: 562
IO#gets describes behaviour for a negative limit argument that MRI does not adhere to and is not mentioned in online rubydoc or tested in rubyspec--Gr...more...
Dave Thomas says: I believe however that the book is correct: rb_io_getline_1(VALUE rs, long limit, VALUE io) { VALUE str = Qnil; rb_io_t *fptr; int nolimit = 0; rb_encoding *enc; GetOpenFile(io, fptr); rb_io_check_char_readable(fptr); if (NIL_P(rs) && limit < 0) { str = read_all(fptr, 0, Qnil); if (RSTRING_LEN(str) == 0) return Qnil; } else if (limit == 0) { return rb_enc_str_new(0, 0, io_read_encoding(fptr)); } else if (rs == rb_default_rs && limit < 0 && !NEED_READCONV(fptr) && rb_enc_asciicompat(enc = io_read_encoding(fptr))) { NEED_NEWLINE_DECORATOR_ON_READ_CHECK(fptr); return rb_io_getline_fast(fptr, enc, io); }
  • Reported in: P3.0 (13-Jun-14)
#76860
Paper page: 569
In the description of IO#read_nonblock(), book says "the call may return EAGAIN and EINTR errors". Rather than saying 'return', a better way would be ...more...
  • Reported in: P5.0 (05-Mar-14)
#76481
PDF page: 730

CSV(STDOUT, col_sep: "|") do |csv|
should read
CSV.new(STDOUT, col_sep: "|") do |csv|--Stuart Blair

  • Reported in: P4. (14-Dec-12)
  • Fixed: 20-Feb-13, awaiting book release
#50379
Paper page: 742
In the description for Time.local, the text reads: "The second form accepts ten arguments . . ." The ten argument form is actually the first form sho...more...
  • Reported in: P5.0 (09-Oct-13)
#53016
PDF page: 797
In the Tsort example the dependencies var in the example needs to be a: @dependencies = Hash.new {|h,k| h[k] = []} The last add_dependency in ...more...
  • Reported in: P4.2 (29-Aug-12)
  • Fixed: 20-Feb-13, awaiting book release
#49757
PDF page: 811
The index entry for %{...} takes me to 298 but it should take me to the table on page 296. I have a hard time using the book as a reference guide. ...more...
Dave Thomas says: It takes you to 298 because that is the specific use of %{...}
  • Reported in: P4. (05-Apr-13)
#51241
Paper page: 818
The order of the modules in the Standard Library chapter in P4.0 goes OpenSSL (pg 815), OptionParser (pgs 816-817), OpenStruct (pg 818). I'm pretty s...more...
  • Reported in: P5.0 (20-Feb-13)
#50842
Paper page: 833

Index entry for "return" has "The ii tag should not be here." Looks like an error from the index generator. --Dave Liebreich