Errata for _The Ruby Way_, 1st printing
19 February 2002
Page Found by Problem
---- ---------------- ------------------------------------------
10 Mike Hall "site" should be "sight" (Sams did this)
10 Mike Hall "for what is" - omit "what is" (Sams!)
20 Mike Hall Code fragment needs indenting
21 Mike Hall Code fragment needs indenting
23 Hal Fulton Code fragment needs indenting
23 Hal Fulton zero-indexed"; (move semi outside quote)
24 Hal Fulton Code fragment needs indenting
25 Jos Backus exit if not str or str.chomp!.empty?
28 Hal Fulton Code fragment needs indenting
29 Hal Fulton Code fragment needs indenting
30 Hal Fulton Code fragment needs indenting
31 Hal Fulton Code fragment needs indenting
32 Hal Fulton Code fragment needs indenting
32 Stephan Kaemper "repeat" example is incorrect;
Recommend deleting paras starting
"As a crude example..." and "In this
example..."
33 Hal Fulton Code fragment needs indenting
35 Hal Fulton Code fragment needs indenting
39 Stephan Kaemper Class member @@count uninitialized
52 Kent Dahl Reads: condition is false
Should read: condition is true
57 Doug Kearns end_excluded? should read exclude_end?
70 Jos Backus Bottom: "characters" misspelled
71 Jos Backus Top: "characters" misspelled
71 Hal Fulton Brackets missing
92 Hal Fulton Trash! fix from original source
105 Hal Fulton 2nd 6.12 should be 6.14
116 Hal Fulton That's not a lowercase sigma!
121 Stephan Kaemper DST - in other countries also
121 Hal Fulton Move right paren
123 Jack Dempsey %a and %A reversed, comments wrong
128 Hal Fulton Code font: "date" (standard library date)
129 Hal Fulton Get rid of code font: has a method
140 Steven Grady Says "one less"; should say "one more"
141 Stephan Kaemper Missing left paren: (other)
141 Hal Fulton Insert "do not"
159 Jos Backus join should be join(" ")
161 Hal Fulton Code fragment needs indenting
174 Jos Backus Reads: shift and unshift
Should read: unshift and shift
191 Garance Drosihn Code wrong! exhaustive, not binary search.
192 Hal Fulton Replace += with << (twice)
192 Garance Drosihn Replace last six lines of listing
(as shown below).
206 Hal Fulton Indent first line
207 Hal Fulton Indent first line
208 Hal Fulton Code fragment needs indenting
209 Hal Fulton Code fragment needs indenting
209 Hal Fulton Remove extra blank space: " that many"
211 Jos Backus Reads:
perms = File.stat.mode("somefile")
Should read:
perms = File.stat("somefile").mode
217 Hal Fulton Change "j ust" to "just"
229 Hal Fulton Code fragment needs indenting
237 Jos Backus Reads: you have a table
Should read: you have a database
247 Jack Dempsey In attr_writer comment, a1 should be b1
259 Hal Fulton Spelling of "makeWithdrawal"
264 Phil Thomson Listing 5.7, 1st line: "module" not "class"
266 Hal Fulton Inadequate indentation
294 Hal Fulton Change ; to :
294 Hal Fulton Inadequate indentation
310 Hal Fulton Blatant falsehood in final paragraph.
Delete last sentence and replace with:
"We don't advocate the careless use of
globals in real-life programs."
327 Hal Fulton Indent first line
335 Guy Hurst Should say: "Today is..." not "Hello..."
366 Hal Fulton 2nd "right" should say "wrong"
402 Hal Fulton Change "others ports" to "other ports"
413 Hal Fulton Code fragment needs indenting
495 Guy Hurst 2nd para: Omit (otherwise...)
506 Guy Hurst Note: attrs cannot be accessed by "self."
514 Guy Hurst Leftover HTML junk
Page 191:
def search(x)
if self.data == x
return self
elsif x < self.data
return left != nil ? left.search(x) : nil
else
return right != nil ? right.search(x) : nil
end
end
Page 192 (replace last 6 lines of listing with these 8):
str = tree.to_s
# str is now:
# "[bongo,[grimace,[[jewel],monoid,[[nexus],plover,[synergy]]]]]"
arr = tree.to_a
# arr is now:
# ["bongo",["grimace",[["jewel"],"monoid",[["nexus"],"plover",
# ["synergy"]]]]]