We try to keep our books accurate, but sometimes mistakes creep in. This page lists the errors submitted by our astute readers. If you've found a new error, please submit it.

The latest version of the book is P4.1, released 7 months 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.

Key: Typo Tech. Error Suggestion Not a problem Next edition

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

(To find out what version you have, look at the copyright page, a few pages in from the front of the book. If it says (say) 'Second Printing', then here it'll be P2.0. If there are interim PDF releases in that printing, they'll be 2.1, 2.2, and so on.)

PDF Paper Description Found in Fixed in
1

#47909: Title page says "Updated for Ruby 1.9.2" in the top right corner. Should say "...1.9.3" now.--Carsten Bormann

P4.1
06-Nov-11
7

#48309: In "The Socket API" in the last sentence on page 7, the word "local" is misspelled as "locat".--Kim Shrier

P4.1
15-Dec-11
41
#48723: The example of a while loop has a combination of conditions and init values that will not allow a single iteration. I suppose, either num_p...more...
P4.1
15-Feb-12
78

#48398: The line `triangular_numbers = Enumerator.new do |yielder|` is not correctly indented.--Trung LE

P4.1
25-Dec-11
106
#48721: mid-page. The book gives the result of show_regexp(string, /\p{Greek}/) as the pi character, whereas the first delta character matched for me....more...
Dave Thomas says: It does indeed.
P1.0
14-Feb-12
137
#48720: mid-page. Regarding ||=, it seems to me that the assignment does take place when the variable was already set to nil or false. I am using ruby...more...
Dave Thomas says: By set, it means not a false value (nil or false)
P1.0
14-Feb-12
157
#48719: Dave, Your use of caller[1..-1] deserves more explication elsewhere in the book so that users will learn to use range i..-j in array elemen...more...
Dave Thomas says: I think I'm happy the way it is—the two elements of the range are independentRuby is simply using the range in this instance as a way of packaging two numbers.
P1.0
14-Feb-12
182
#49160: Paragraph beginning "We create 10 threads..." - fourth sentence ("The reason is that...") in a tangle. "Continue" misspelled in third from las...more...
P4.1
20-Apr-12
189
#48434: cool book, I really like it but roman << code unless count.zero? seems to be incorrect count.times { roman << code } is better, I thi...more...
Dave Thomas says: (as I show two pages on... it's a deliberate mistake)
P4.1
30-Dec-11
190
#48267: In the sentence after the heading "Assertions == Expected Results", there is a missing word "a" before the word "series". It should read, "R...more...
Dave Thomas says: Actually, I meant multiple series....
P4.1
13-Dec-11
274
#48764: In .irbrc file IRB.conf[:PROMPT][:MY_PROMPT] Then use $ irb --prompt my-prompt Thus sentence "(Notice how the name of the prompt mode ...more...
Dave Thomas says: The prompt you type on the command line is converted....
P4.1
18-Feb-12
295

#48757: Trailing '}':
<%= ruby expression %>}--Greg Bolshaw

P4.1
17-Feb-12
333
#49292: In "Ranges in Boolean Expressions," the account of the flip-flop mechanism does not tally with the samples (which do agree with the output fro...more...
P4.1
07-May-12
347
#49293: Just a guess, but is "...same logical line as the end of the invocation" supposed to be "same _lexical_ line"? Hope so, cos if not I'm missing...more...
Dave Thomas says: I meant it in the sense of "logically on the same line" as it could in theory appear after a \ on the next line. I agree lexical line is more accurate, but I think it's also more confusing. I changed it to "logical source line"
P4.1
08-May-12
349
#48826: "The first two styles of Proc object are identical in use. We’ll call these objects raw procs. The third and fourth styles, generated by lambd...more...
Dave Thomas says: See the previous page—there's also passing a block to a method with an ampersand parameter
P4.1
28-Feb-12
355 355
#48715: (which must start on the same source line as the last line of the method call) i think phehaps fixed to: (which must start on the same ...more...
Dave Thomas says: I think that's also a little suspect, given the last argument can span multiple lines. I think the meaning is clear.
P2.0
13-Feb-12
364

#49330: Page 364 implies that:

names = %w{ant bee cat}
result = names.map(&:upcase)

only works on 1.9, this seems to work on 1.8.7 also.--Thijs de Vries

P4.1
16-May-12
370

#48731: Sentence at end of fifth paragraph, "The Kernel module does defines puts" should read "does define puts." Define not defines.--Roy Ratcliffe

P4.1
16-Feb-12
439
#48749: some additional Array public instance methods (some seem to override Enumerable): collect drop drop_while first hash include? inspect ...more...
Dave Thomas says: I chose not to document these, as they are (to the best of my knowledge) simply an implementation detail. They act as if they were the enumerable versions
P1.0
17-Feb-12
442

#47929: Examples for repeated_permutation say "repeated_combination" instead of "repeated_permutation".--Gus Gollings

P4.1
10-Nov-11
455

#48737: BasicObject ! method: in sentence "Returns false unless obj is false", I believe you meant the second 'false' to be in Roman font, being false or nil.--Walter Urbaniak

P1.0
16-Feb-12
456

#48740: Is BasicObject method_missing a private instance method and should not have a receiver?--Walter Urbaniak

P1.0
16-Feb-12
456
#48531: (This _might_ be more of suggestion for clarifying the content.) In the description of the Binding class, the text says: "The variables,...more...
Dave Thomas says: I changed it to say "access to the....":
P4.1
15-Jan-12
461

#48744: Isn't Class.inherited an instance method (of class Class) not a class method: Class#inherited, cls.inherited?--Walter Urbaniak

Dave Thomas says: Unless I'm looking at the wrong place, it is listed as a private instance method
P1.0
17-Feb-12
464

#48389: The return type of Complex#to_i should be integer. "complex.to_i -> float" should be "complex.to_i -> integer"--Eito Katagiri

P4.1
23-Dec-11
473

#48393: "Encoding.find(name) \returnsenc" should be "Encoding.find(name) -> enc". --Eito Katagiri

P4.1
24-Dec-11
478

#48745: additional Enumerable public instance methods:
chunk
collect_concat
each_entry
flat_map
slice_before--Walter Urbaniak

Dave Thomas says: These are documented in the later printings and ebooks
P1.0
17-Feb-12
482

#48746: Enumerable.inject: suggest adding the (5..10).inject(:*) example (as from page 60).--Walter Urbaniak

P1.0
17-Feb-12
483

#48747: Enumerable.none?: the parenthesized clause copied from .any? needs to be fixed for .none? .
--Walter Urbaniak

P1.0
17-Feb-12
488

#48748: additional Enumerator public instance methods:
feed
inspect
next_values
peek
peek_values
--Walter Urbaniak

Dave Thomas says: These are documented
P1.0
17-Feb-12
508

#48769: File: I don't think lchmod and lchown are presently instance methods though they are class methods.--Walter Urbaniak

P1.0
19-Feb-12
522
#48397: In File::Stat#world_readable?, "File.world_readable?(filename) -> ..." should be "statfile.world_readable?(filename) -> ...". The examples are...more...
P4.1
24-Dec-11
529

#48493: "flt == obj \returnstrue or false" should be "flt == obj -> true or false"--Eito Katagiri

P4.1
11-Jan-12
536
#48659: Hash.[] has an important third form, which is not documented here: Hash[ [ [key, value], ... ] ] → new_hash see www.ruby-doc.org/cor...more...
Dave Thomas says: Their example is actually Hash[ [ [ 1,2], [3, 4] ] ] They are passing a single array argument, whose .to_hash method is then called
P4.1
04-Feb-12
539

#48763: IO::foreach : io.foreach should be IO.foreach.
--Walter Urbaniak

Dave Thomas says: I can't find this
P1.0
18-Feb-12
540
#48963: default_proc= Sets the proc to be called to calculate values to be returned when an array is accessed with a key 1.9 it does not contain. ...more...
P4.1
20-Mar-12
545

#48965: for select! - the description should say "hsh" not "arr". --Andrew Gellene

P4.1
20-Mar-12
553

#47912: s/8BUT/8BIT/

P4.1
07-Nov-11
554

#48660: "File.new(..." should be "IO.new(..."--Eito Katagiri

P4.1
04-Feb-12
588

#48741: Module class_variable_set: "Returns" should be "Sets".--Walter Urbaniak

P1.0
16-Feb-12
589

#48742: Should Module const_missing show a receiver, since it seems to be a public instance method, though Ruby might only invoke it on self?--Walter Urbaniak

P1.0
16-Feb-12
592

#48743: Module module_eval: mod.class_eval(...) should be mod.module_eval.
--Walter Urbaniak

P1.0
16-Feb-12
613

#48738: additional (Kernel public) instance methods:
<=>
initialize_clone
initialize_dup
respond_to_missing?
singleton_class
--Walter Urbaniak

Dave Thomas says: These are documented
P1.0
16-Feb-12
614

#48725: define_singleton_method : obj.define_method => obj.define_singleton_method--Walter Urbaniak

Dave Thomas says: I can't find this
P1.0
15-Feb-12
623

#48739: additional Object private instance methods:
gem_original_require
initialize_copy
get_methods--Walter Urbaniak

Dave Thomas says: There are a few methods such as these that I choose to ignore because they are basically intended for the implementors, and not the rest of us folk.
P1.0
16-Feb-12
624

#48736: singleton_method_added, singleton_method_removed, and singleton_method_undefined appear to be inherited from BasicObject.--Walter Urbaniak

P1.0
16-Feb-12
632

#49109: The Object#untrusted? method signature; "obj.untrusted -> true or false" should be "obj.untrusted? -> ..."--Eito Katagiri

P4.1
14-Apr-12
647
#48020: The description of the sleep method says "An argument of zero causes sleep to sleep forever". And the signature shows 0 as the default value...more...
P4.1
23-Nov-11
660
#48914: The documentation for Process.daemon refers to the daemon(2) system call but it appears to be daemon(3). The link in the pdf results in an uns...more...
P4.1
08-Mar-12
660
#48304: In the description of the daemon method, first sentence, parenthetical expression, you have misspelled setsid. You have Process.setssid inste...more...
P4.1
15-Dec-11
696
#47976: In the definition of the String#[] method, this: "If a name follows the regular expression, the corrsponding named match is returned" sh...more...
P4.1
19-Nov-11
710
#48456: The documentation for String#ord states in part "Note that it isn’t quite the inverse of Integer#chr, because the latter does not deal with en...more...
P4.1
04-Jan-12
858
#49228: In the 2nd line of tk library description, "~" between "OS" and "X" should be a space; "Window, Linux, Mac OS~X, and other ..." should be "Win...more...
P4.1
29-Apr-12
910
#49334: The index entry for the "Set" class reads something like Set class: 430-433, 839 However, the Set class is only documented on page 83...more...
P4.1
16-May-12