The eBook says -
Ruby 2.0 is a (farily minor) incremental improvement on Ruby 1.9.
but should be
Ruby 2.0 is a (fairly minor) incremental improvement on Ruby 1.9.
2013-03-27
5
OK
Windows nanny warnings
should be
Windows many warnings
2013-02-25
Actually, no. Windows has a habit of acting like scolding nanny some times.
6
TYPO
The image on this page should probably be for Ruby 2.0.0-p0
2013-03-27
In an ideal world... :)
61
TYPO
In the last sentence, “build”, should probably be “built”:
Fortunately, if you’re using Ruby 2.0, you have this support build in.
2013-03-28
380
TYPO
The new section on prepend has a type should be the word ‘take’ not ‘tke’
2013-03-28
62
TYPO
At the end of the first paragraph, then second “then” should probably be “they”:
and then then only consume enough to satisfy that request.
In the last sentence of the first paragraph after the code sample, “enumberator” should be “enumerator”:
see how we convert the basic generator into a lazy enumberator with the call to lazy
In the first sentence of the first paragraph after the second code sample, the first occurrences of “select” should probably be get the inline code styling (san-serif)—the parallel construction “call to first” near the end of this paragraph uses this styling:
the call to select would effectively never return
Similarly, the first occurrence of “select” in the second sentence of that same paragraph should also probably be code styled:
the lazy version of select only consumes
2013-03-28
63
TYPO
In the first text paragraph (after the initial code sample), the word “Enumerator” should get the normal class styling (san-serif).
… simply return new Enumerator objects?
In the last sentence before the “Blocks for Transactions” section, perhaps “filter one piece” instead of “filter piece” (i.e. insert the word “one”):
… build up a complex filter piece at a time.
2013-03-28
X
OK
The footnotes are not fully displayed on kindle paperwhite.
2013-04-04
This would seem to be a problem with the Kindle, as they check out fine ofn other readers (including other Kindles)
101
TYPO
First sentence of the “New in 2.0” paragraph, “depnding of” should probably be “depending on”:
… have different interpretations depnding of the character set option …
2013-03-28
111
TYPO
In the first sentence of the “Conditional Groups” section, the word “Omigmo” should probably be “Onigmo” (the first M should be an N).
2013-03-28
114
TYPO
In the third paragraph of the “Alternatives in Conditions” section, “buck” should probably be “bucket”.
… colors of the ball and buck must be …
2013-03-28
115
TYPO
In the last sentence of the first paragraph of the “Setting Options” section, “on” should probably be “an”:
… That sequence sets on option …
2013-03-28
9
SUGGEST
Could (maybe should?) you not replace
sudo aptitude install…
with
rvm requirements
or is this too new a feature?
2013-03-28
316
TYPO
“An asterisk at the end of end …” (double end)
2013-03-28
337
TYPO
“am optional double-splat” (am -> an)
2013-03-28
10
ERROR
$ rvm default 2.0.0
command from original text didn’t work:
The rvm use command applies only to the current terminal session. If you want to make it apply to all your sessions, issue this command:
$ rvm —default 2.0
2013-03-28
413
TYPO
“Ruby 2.0 gives us a new was of doing this.” should be “Ruby 2.0 gives us a new way of doing this.”
2013-03-28
414
TYPO
In the second paragraph of section 25.5, the second line starts with a comma that’s dangling from the first line, likely because there’s a bit of literal text (‘set_trace_func’) immediately before it. The comma should be at the end of the previous line, or the ‘set_trace_func’ should be on the second line.
2013-03-28
439
ERROR
Within Built-In Classes and Modules, under Array the ‘at’ method is repeated a second time.
2013-03-28
216
TYPO
The descriptions of the —disable-all and —enable-all options end in an unclosed parenthetical:
… (see the following descriptions.
2013-03-28
221
TYPO
The descriptions of the stack size environment variables have inconsistent spacing in the “word size” descriptors:
RUBY_THREAD_VM_STACK_SIZE uses no spaces: “32bit” and “64bit”
RUBY_THREAD_MACHINE_STACK_SIZE uses a mixture: “32bit”, but “64 bit”
2013-03-28
250
TYPO
Chapter 17
The last sentence of the first paragraph of the section titled “Source Elements That Have Encodings” appears to be incomplete:
… do sneak into your source,
(The paragraph ends with a comma.)
This looks like it might be left over from reworking the content into the immediately prior “Ruby 1.9 vs. Ruby 2.0” section: they both cover the same source file encoding details while the prior ends with a description of the change in default encoding in Ruby 2.0.
2013-03-28
309
TYPO
Chapter 22, section 22.1 “Source File Encoding”
It looks like there is a missing period between “coding:” and “Ruby 2” in the next to last sentence:
… Ruby skips characters in the comment before the word coding: Ruby 2 assumes …
2013-03-28
315
TYPO
Chapter 22; section 22.3 “The Basic Types”; subsection “Regular Expressions”
In the first paragraph “Omiguruma” should probably be “Oniguruma” and ”Omigmo” should probably be “Onigmo” (both N instead of first M).
Also, the paragraph ends in the nonsense placeholder(?) “; flqg”.
2013-03-28
316
TYPO
Chapter 22; section 22.3 “The Basic Types”; subsection “Regular Expression Patterns”
There are (what look like) doubled periods at the end of the descriptions of \\s, \\w, \\D (\\H, \\S, \\W), and \\R. This also happens for \\X on the next page.
In the description of \\K, the first word should probably be “Discards” instead of “DIscards” (lowercase second letter).
2013-03-28
56
TYPO
This paragraph seems garbled:
The each iterator has a special place in Ruby; , we’ll describe how it’s used as the basis of the language’s for loop on page 142, and starting we’ll see on page 79 how defining an each method can add a whole lot more functionality to the classes you write–for free.
There seem to be words missing between the “;,” and “… and starting we’ll see …”
2013-03-28
629
TYPO
define_method, at the bottom of the page, starts out “Defines a global method. send hack in this example).” Looks like some text got bent up a little.
2013-03-28
672
TYPO
In the text for #size: “In Ruby 2.0, only words for…”; “words” should be “works”.
2013-03-28
724
TYPO
In Thread#[]: “afibre-local” should be “a fiber-local”
The term used to describe the indicator used to receive or pass keyword arguments by hash is Inconsistently hyphenated as “double splat” and “double-splat” in this section and the following one (“Invoking a Method”).
2013-03-28
340
TYPO
Chapter 22, section 22.8 “Invoking a Method”
… Ruby matches the keys in the passed hash with each argument, assuming values when it finds a match.
“assuming” seems odd here. The arguments might might assume values, but it does not seem right that Ruby (the subject of the sentence?) is assuming values here. Maybe “assigning” would be better?
If the passed hash contains any keys not defined are arguments, …
Maybe “are arguments” should be “as arguments” (or even “as keyword arguments”).
2013-03-28
340
ERROR
Chapter 22, section 22.8 “Invoking a Method”
The code sample for passing undefined keyword arguments vs. accepting them into a double-splat argument seems to have some problems.
First, `keyword1` is defined, but never called (incidentally, it seems identical to the `keyword` definition in the prior code sample). Second, this definition shows an error message in its commented output that seems to belong to the following invocation of the `keyword` method (which was defined in the prior sample, but is not defined for the context of this sample?).
The invocation of `keyword` seems like it is supposed to show the runtime error message that results from passing an undefined keyword argument, but there is no commented output associated with this line. Maybe it was meant to call `keyword1`?
2013-03-28
380
TYPO
Chapter 24, section 24.4 “Modules and Mixins”, subsection “prepend”
The end of this subsection looks like it contains some editing leftovers:
We’ll see how to fix that shortly when we look at refinements. across our entire program—both our own code and all library code will
The elaboration on the global nature (starting with “across our entire”) should probably be deleted or rewritten to clarify that it is giving more detail about the global modification done to `Object`.
2013-03-28
381
TYPO
Chapter 24, section 24.4 “Modules and Mixins”, subsection “Refinements”
They apply not just the the code we wrote …
The first “the” should probably be “to”.
… someone elses library code …
I think “elses” should have an apostrophe: “else’s”
2013-03-28
383
ERROR
Chapter 24, section 24.4 “Modules and Mixins”, subsection “Refinements”
In the multi-file refinement code sample, the absolute pathname of your filename is shown as a part of the “warning: Refinements are experimental” message that Ruby is generating. This also happened earlier in this subsection, but the leaked pathname was just `/tmp/prog.rb`, which much less personal.
2013-03-28
383
TYPO
Chapter 24, section 24.4 “Modules and Mixins”, subsection “Refinements—use and scoping”
In the next to last sentence in this subsection “been” should probably be deleted.
A refinement is been activated …
2013-03-28
413
TYPO
Chapter 25, section 25.4 “System Hooks”
… behind the host module or classes own methods …
I think “classes” should be possessive, and maybe also “module”
“behind the host module’s or class’s own methods”
or perhaps
“behind the methods of the host module or class”
… method with the name name …
The first “name” should probably be “same”.
… module’s methods before the hosts.
Perhaps “host’s” (possessive), instead of “hosts”.
2013-03-28
129
TYPO
“ealier” - more ealy?
“We saw ealier”
2013-03-28
xii
TYPO
Ironically, the footnote with the link to the errata page is incorrect. It should be http[colon]//pragprog[dot]com/titles/ruby4/errata/ The link in the current footnote takes you to the errata page for the third edition.
2013-03-27
820
SUGGEST
“For that reason, we’ve put the reference section online at …pragprog.com/titles/ruby3” refers to the previous edition of the book. In any case, would it be better to link directly to the reference? It’s not obvious that I have to go to the “Contents/Extracts” tab to find it.
2013-03-28
13
TYPO
The Japanese signature of Matz is wrong.
The second character “tsu” is small.
Large(Not small) “tsu” is correct.
2013-03-28
Is wikipedia wrong?
\n
\nhttp://en.wikipedia.org/wiki/Yukihiro_Matsumoto
\n
\n
439
TYPO
Chapter 27, Array#bsearch
The result of Array#bsearch has an extra trailing greater-than sign:
… → obj or nil>
Technical Error?:
In the description of the boolean-returning block mode, the first “less” should probably be “greater”:
… find the minimum value in arr less than or equal to the required value, …
Suggestion:
The first two clauses in the description of the number-returning block mode refer to comparing a value to either a lower or an upper bound, but the last clause just says “zero if it is equal” (equal to what/which?). It might be clearer if it said something like “zero if it is between the bounds”.
2013-03-28
452
TYPO
Chapter 27, Array#values_at
The mention of “nil” in the description of Array#values_at should probably be styled.
2013-03-28
506
TYPO
Chapter 27, File.fnmatch
In the description of FNM_EXTGLOB, “patern” should probably be “pattern”. Also, maybe omit “if set”, since it is implied; most of the other flag descriptions do not mention it, either.
Expand braces in the patern if set.
2013-03-28
601
ERROR
Chapter 27, Module.refine
Since the example usage of refine does not produce any normal output, the stdout/stderr output (“produces:”) only shows the refinement warning. Maybe either show the result of the upcase invocations in comments, or use puts to explicitly send them to stdout.
2013-03-28
603
TYPO
Chapter 27, Mutex
The descriptions of the Mutex instance methods lock, sleep, synchronize, try_lock, and unlock all end with “called from a trap handler..” (doubled period).
2013-03-28
626
TYPO
Chapter 27, Object
In the example of Hash(), maybe the last example should use both h1 and h2, not just h1 twice:
Hash(*h1,*h1)
2013-03-28
628
TYPO
Chapter 27, Object
In the synopsis for the caller method, there is what looks to be an extra comma before the max_size argument.
2013-03-28
629
TYPO
Chapter 27, Object.caller_locations
In the example of Object.caller_locations, the definition of outer is adorned with “commented output”, but it looks like this output does not belong here; the same output shows up at the invocation of outer, which does seem appropriate.
2013-03-28
645
TYPO
Chapter 27, Object.using
The description of Object.using mentions that the scope of the refinement is limited to a “string if exec is being used”, but I think this should be “eval”, not “exec”.
Also, the word “using” should probably be styled in the text “from the point where using is called”.
2013-03-28
671
TYPO
Chapter 27, Range.bsearch
Maybe the second example of Range.bsearch should use (0.0..Math::PI/2) since that limits it to a domain for which sin is monotonic.
2013-03-28
Seriously good eye! Thanks
689
TYPO
Chapter 27, String.bytes
In the description maybe “Ruby 2” should be “Ruby 2.0” (for consistency with most other such references).
There is a trailing greater-than at the end of the description text.
The last bit of the example may want to use “.bytes {…}” instead of “.bytes.each {…}” to demonstrate that bytes returns the original string when called with a block.
2013-03-28
689
TYPO
Chapter 27, String.byteslice
The second synopsis (“(int,int)”) seems redundant since the first shows the optional, second argument.
2013-03-28
691
SUGGEST
Chapter 27, String.chars
The description of String#chars is possibly missing a cross-reference to String#codepoints to go with the one to String#bytes.
Like String#bytes, maybe the last bit of the example should use “.chars {…}” instead of “.chars.each {…}” to show that the whole string is returned when chars is called with a block. Looking ahead a bit, this also potentially applies to String#codepoints on the next PDF page.
2013-03-28
62
TYPO
The word enumberator should probably be enumerator.
2013-03-28
290
TYPO
under Generating HTML with CGI.rb, you state that the examples will be using html3, but they in fact use html4.
2013-03-28
246
239
OK
In Anagram::Finder.signature_of, the input is case sensitive, thus Anagram::Finder.signature_of(‘Wombat’) != Anagram::Finder.signature_of(‘wombat’)
The use of downcase or upcase in the Anagram::Finder.signature_of method should correct this.
2013-03-28
I'm happy with is the way it stands...
246
239
SUGGEST
In Anagram::Finder.signature_of, I wonder if it might be clearer to use word.each_char.sort.join instead of word.unpack(‘c’).sort.pack(’c’)
While exposure to the pack and unpack methods is good, it doesn’t seem to be explained in this section, or a previous section, which may confuse the current topic.
2013-03-28
I did it because it runs about 70% faster using pack/unpack.
253
SUGGEST
On section 17.3 - it should be noted that #bytes now returns an array in Ruby2.0, so no need to do “.bytes.to_a”
2013-03-28
1
SUGGEST
Please search and replace rvm.beginandrescueend.com with rvm.io
2013-03-27
316
TYPO
s/flqg/flag/
Ain’t no such word as ‘flqg’.
(first paragraph under “Regular Expressions”
2013-03-28
48
TYPO
leys sb keys
2013-03-28
10
OK
Setting the default ruby is shown as
$ rvm —default 2.0
but should be
$ rvm —default 2.0.0
2013-03-28
On my machine, 2.0 works fine. But I've changed it to 2.0.0 for consistency
20
TYPO
it says “rvm —default 2.0” but it should say “rvm —default 2.0.0” because rvm does not accept incomplete version numbers.
2013-03-28
xi
OK
“making Ruby one of the only programming languages” sounds strange to me. I’d prefer “one of the very few” or something like that.
2013-03-27
I think it's OK as it stands.
8
SUGGEST
Though it’s a peripheral issue here, I think you should finally update the Ubuntu version you refer to! :o)
2013-03-27
Not sure I see a specific reference (apart from the note on special handling needed on Lucid, which still stands)
124
TYPO
First sentence of “Hash and keyword arguments” section: “…using hashes as a way of passing…”
2013-04-04
611
TYPO
The description for #modulo contains a code snippet with what appears to be a superfluous “}”: `num.divmod(}numeric)[1]`
2013-04-04
161
TYPO
Last sentence of first paragraph on page: “…we show only the first three”
2013-04-04
56
TYPO
“The each iterator has a special place in Ruby; ,” double punctuation, remove comma leave semicolon.
2013-04-04
75
TYPO
“we start the server then call join which causes it to wait for the server to exit before itself exiting.”
2013-04-04
29
SUGGEST
There is an example called “Book In Stock” in this chapter. “The row contains the book’s ISBN and price”. But in the following sample csv (on page 29), the last column has been named “Amount” ( “Date”,“ISBN”,“Amount” ). And so is sample code on page 38 , “row[”Amount“]”, and “we extract the data from the ISBN and Amount columns” on page 38, and “row[”Amount“]” on page 39. All other place are using “price” in both sample code and text. Suggest to replace “amount” with “price”
2013-04-04
77
SUGGEST
The “Inheritance and Mixins” section has been placed in a chapter of “Modules”, I think this section is irrelevant to “Modules”. In the Kindle version, this section is before the chapter of “Modules”.
And at the end of this section, “We’ll explore mixins a little later on page 77.”, actually, this section IS on page 77, it references(links to) the page that itself is on.
2013-04-04
845 +
SUGGEST
You neglected to include the index in the epub (and presumably mobi) version of the book. This is quite disappointing, as (especially with a technical book) the index is a very valuable resource. Tagging the references to create an index that links to the paragraph level can be tedious, but it’s worth it. If that’s not an option, you should at least link to the print page (easy enough to target and RegEx the page references in your index)
2013-04-04
We don't include the indices in any of our mobi or epub books. We tried, but they were frankly unwieldy to use.
\n
\nOur technology currently does index to the character-within-paragraph level (try them in the PDF eBook). But we're unlikely to add the to the other formats until the reader software gives us decent support.
\n
407
ERROR
In section 25.1, output of ObjectSpace.each_object looks incorrect—at the very least, it doesn’t include the two float variables defined.
2013-04-11
Hmm... that's actually what Ruby 2.0.0 is returning. I've asked if it is a bug.
\n
\nAnd the answer is "No, it's a feature" Ruby 2 now makes most Floats immediate values on 64 bit architectures. I've updated the example and added a note.
437
TYPO
In the description of <=>, at the end of the second line, it says “If any pair arenot…” instead of “If any pair are not…”
2013-04-11
127
TYPO
We’ll talk more about if and caselater on page 137.
^
Insert space between keyword ‘case’ and link ‘later on page 137’
2013-04-11
9
TYPO
The following sentence from the section “Source Code from This Book” has an extraneous “B”:
Sometimes, B the listings of code in the book correspond to a complete source file.
2013-04-11
235
TYPO
Footnote 3 says “bring” instead of “string”.
2013-04-11
435
SUGGEST
In the PDF version of the book, it would be really handy if methods named in the “Mixes In” section of the class documentation were linked the their documentation instead of just being dead text.
2013-05-17
That's a nice idea, but I'm afraid it would be quite time consuming to implement.
227
TYPO
In the second paragraph, it says “eariler” instead of “earlier”.
2013-05-16
56
TYPO
The paragraph beginning “The each iterator has a special place in Ruby;, we’ll describe…” has an extraneous comma; it should read “The each iterator has a special place in Ruby; we’ll describe…”
2013-05-16
315
TYPO
last line: “Onigmo” instead of “Omigmo”!?
2013-05-16
Onigmo is correct (I believe)
311
TYPO
Below discussion of %I, %Q and %W:
“Following the type character is a delimiter, which can be any nonalphanumeric_ic_” delete repeated characters.
2013-05-16
330
TYPO
Line 3 of Table for the []= operator,
var[“a”, /^cat/ ] = “three”}
has unnecessary right brace ‘}’ after “three”.
2013-05-16
332
TYPO
Ranges in Boolean Expressions
if expr1 .. expr1
while expr1 .. expr1
Assume it should be ‘expr2’ after the dots in both cases.
2013-05-16
338
TYPO
Keyword Arguments
“…parameters that are not defined are arguments, an error will be raised” “are” should be “as”.
2013-05-17
385
ERROR
In the example involving classes Logger and Example, you state that the add_logging call in the declaration of class Example will define an instance method log on class Example. This is incorrect, it (oddly enough?) actually defines it on class Logger. See link for more detail and code:
gist.github.com/jiaweihli/8924babbed7573faa04f
2013-05-16
50
OK
In the second example for count the word frequency is a little mistake:
for i in 0..5
word = top_five[i][0]
count = top_five[i][1]
puts “#{word}: #{count}”
end
The program runs in an exception, because the array length is 5
Please change this in:
for i in 0..4
word = top_five[i][0]
count = top_five[i][1]
puts “#{word}: #{count}”
end
2013-05-17
The code in the book has 0...5 (three dots)
105
SUGGEST
Named matches only set local variables if the regular expression is on the left side of the expression (i.e., /RE/ =~ string). This paragraph did not make it clear that this was the case:
The named matches in a regular expression are also available as local variabless. (This works
only with literal regular expressions. You can’t assign a regular expression object to a variable,
match the contents of that variable against a string, and expect the local variables to be set.)
Also, on page 110 of the PDF, there are several examples with named matches with the RE on the right side of the expression. I think it would be better to switch the RE and string so people coming from a perl background (like me) would be more inclined to migrate to the preferred Ruby RE style.
2013-05-16
160
OK
… and in detail on the book’s web page at …
The link seems out of date, and not a specific reference to the socket library.
2013-05-27
Click the Contents/Extracts tab—it's at the bottom
338
TYPO
def header example for illustrating **arg—this code doesn’t work as expected. Line 3 should be something like\\
attr_string = attrs.map {|k,v| %{“#{k}=#{v}”}}.join(’ ’)
2013-05-16
347
SUGGEST
In section 22.13 Paragraph 2:
“Braces have a high precedence; do has a low precedence. If the method invocation has parameters that are not enclosed in parentheses, the brace form of a block will bind to the
last parameter, not to the overall invocation. The do form will bind to the invocation.”
I can’t get my head around this easily, an example would really help.
2013-05-16
13
ERROR
The flickr link in the notes is marked as private and redirects to the home page.
2013-05-16
It seems to work for me
24
TYPO
You can use parentheses within patterns,
just as you can in arithmetic expressions, so you could also have written this pattern
like this:
/P(erl|ython)/
Should this be written as /(Perl|Python)/?
2013-05-16
No, it's fine as it stands. It's a "P", followed by either "erl" or "ython"
325
OK
The book says “This variable may be set from within a program to alter the default search path; typically, programs use $: << dir to append dir to the path. [r/o]”
If you can change it, why is it marked “[r/o]” ? Doesn’t that mean read-only?
2013-05-27
The variable is read-only. It's contents may be updated.
\n
\n2.0.0p0 :002 > $: = 123
\nNameError: $: is a read-only variable
\n
\n
35
OK
On ‘Virtual Attributes’ at the price_in_cents method definition, shouldn’t the ‘price’ inside the Integer cast read @price ? (same thing of following page).
Or I missed something?
2013-11-13
It's using the attribute, rather than the instance variable. If I define an explicit attribute, then I will (try to) always use that attribute, and not the instance variable, in the rest of the code. This decouples me from changes I may make later.
221
TYPO
It says = “The machine stack size used at fiber creation: 256KB or 256KB.”
Probably it was 256KB or 512KB.
2013-11-13
39
OK
On several pages where the example code defining read_in_csv_data() is shown the provided code is invalid:
CSV.foreach(csv_file_name, headers: true)
The example worked correctly after changing the above line to:
CSV.foreach(csv_file_name, :headers => true)
2013-11-13
You should be using Ruby 1.9 or Ruby 2 with this book.
39
OK
In the tutorial CsvReader there is a reference to “Price” in the “Data.csv” file, but in that file the reference is called “Amount”, which means that the tutorial doesn’t work :(
2013-11-13
I don't see that issue here.
59
TYPO
This invokes its host class’s each Method
Method in upper case and using code font.
2013-11-13
92
TYPO
.language section
In the first paragraph, the “.” should be deleted.
2013-11-13
37
22
OK
Well, actually a typeface error…
Second last like of the page, the word “produces” is in a small italic typeface. I think it should match the text in the paragraph that precedes the code sample above it (beginning “In fact, symbols are so…”)
2013-11-13
That's the style used throughout the book.
105
TYPO
There is an extra backslash at the end of the second paragraph (there are nine backslashes and there should be eight).
2013-11-13
109
TYPO
In the last paragraph, ”We’re already seen” should be ”We’ve already seen“.
2013-11-13
186
ERROR
The second line in the source sample from `ts_dbaccess.rb` should use `require` instead of `require_relative`.
2013-11-13
213
TYPO
2nd paragraph of ARGF:
changes to make to ARGV
2013-11-13
300
TYPO
spurious ‘}’ in the parenthetical phrase of double-quoted strings in the paragraph above Table 11.
2013-11-13
99
OK
The line (explaining the operation of quotes)
‘escape using “\\\\” ’ # => escape using “\\”
does not properly describe what Ruby 2.0.0p247 does:
‘escape using “\\\\” ’ becomes “escape using \\”\\\\\\" "
I don’t have a different Ruby 2.0.0 to test with, but I would be surprised
if the result was different.
2013-11-13
The book is correct. I suspect you're being fooled by the fact that irb uses inspect to show the result of expressions.
19
ERROR
“On Windows, there’s no real concept of a user’s home directory:”
If you’re not already on your c drive, type “c:” at the prompt and then type: “cd userprofile”
o_O
2013-11-13
101
TYPO
For some of these classes, the meaning depends on the character set mode selected for the pattern. In these cases,
the dfferent options are shown like this:
missed a letter “i” in word “dfferent”
2013-11-13
340
SUGGEST
In section “Rescue Statement Modifier”, “If an exception is raised to the left of a rescue modifier, the statement on the left is abandoned” is a little unclear. For instance in:
a = nil.b rescue ‘c’
it’s not the assignment statement that is abandoned, rather the expression ‘nil.b’.
2013-11-13
254
TYPO
“coding:” is listed in 3 places. I think it should be “encoding:”. This may occur in later pages, too, I’m not sure.
2013-11-13
I can't find this. If it is still an issue, could you resubmit with a little context. Thanks
164
TYPO
should be “requesteD” instead “requester threads” in the second paragraph of Manipulating Threads
2013-11-13
57
OK
[1,3,5,7].inject(1) {|product, element| product*element} # => 105
…
…
This means that we could have written
the previous examples like this:
…
[1,3,5,7].inject {|product, element| product*element} # => 105
It should still be
[1,3,5,7].inject(1) {|product, element| product*element} # => 105
Just because this example array has 1 in position zero inject(1) is not equivalent to inject
2013-11-13
I believe the statement is correct. It uses the first element of the collection as the initial value of the memo, so
\n
\n~~~
\n[5,4].inject :* #=> 60
\n~~
593
TYPO
The description for Numeric#% contains the phrase:
Synonym for Numeric#module
It should read:
Synonym for Numeric#modulo
2013-11-13
460
TYPO
to_yaml_properties may not be needed for custom class serialization. Check the current sources and update.
2013-11-13
52
OK
In CH 4 SEC 3 (4.3), when re-writing the loop from the previous exercise, the first line of code says “for i in 0..4” whereas previously your program said “for i in 0…5”. I know that it’s small, but I would appreciate knowing! Thanks for the great book. I’m really learning so much.
2013-11-13
0...5 is the same as 0..4
74
ERROR
At the bottom of page 74 in the pdf version, the book states: “To reference the name sin unambiguously, our code can then qualify the name using the name of the module containing the implementation we want, followed by ::, the scope resolution operator:” However, sin is a method, so the period would be the proper operator used to reference it. The code shows that correctly, as well as using the :: operator to reference the module constants.
2013-11-13
226
TYPO
middle of page, in sentence preceding code snippet. “contant” should be “constant”.
2013-11-13
218
ERROR
15.5 RubyGems Integration documents ‘-t’ flag for gem install. This is no longer supported in gem install (—test also gone). Verified with 2.0/Mavericks — may have been gone earlier.
This seems to be suggesting that `\\s` will match decimal digits with ASCII or default rules. I have not been able to duplicate this, so I suspect it is an error.
11
ERROR
“(To get a list of classes with ri documentation, type
ri with no arguments.)”
Isn’t that what -l (—list) switch is for?
763
TYPO
“when the file cn be read or written” -> “when the file can be read or written”
438
TYPO
Sample invocation of Array#unshift contains a right curly brace that should be left out.
585
SUGGEST
The example code in Module#prepend documentation is truncated.
298
TYPO
Unlike their lowercase counterparts, %I, %Q, and %W will preform interpolation:
should be ‘perform’
5
TYPO
“… is Luis Lavena’s RubyInstaller.org.” ->
“… is Luis Lavena’s RubyInstaller.”
338
ERROR
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 think the “and ancestors” is wrong, we can’t invoke the private methods in the defining class’s ancestors.
When I try using Integer class method all, I get following error:
undefined method `all’ for Integer:Class (NoMethodError)
I checked online reference for Integer class and method all seems to be missing
320
ERROR
The description of Ranges in Boolean Expressions contains errors, is confusing, and really ought to be rewritten! Both the logic of this expression and the difference between two-dot and three-dot forms could be explained much more clearly: When set, the flip-flop returns true, when unset it returns false. expr1true sets the flip-flop immediately (so it returns true on the current iteration). expr2true unsets the flip-flop before the next iteration (it does not affect the return on the current iteration). In the case that both tests are true in the same iteration, the flip-flop returns true but the three-dot form leaves the flip-flop set whereas the two-dot form leaves it unset. Said another way, the three-dot form ignores the unset test on an iteration in which the set test is true.
xi
SUGGEST
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 students trying to get the correct ‘edition. To add to the confusion, the cover no longer lists ’4th edition’, so with the inclusion of ‘3rd edition forward’, for all intents and purposes, this does seem like the 3rd edition. Please remove or somehow indicate this is not the 3rd edition.
90
ERROR
In the following code on page 90:
class Person
include Comparable
attr_reader :name
def initialize(name) name = name
end
def to_s
"#{name}"
end
def <=>(other)
self.name <=> other.name
end
end
p1 = Person.new(“Matz”)
p2 = Person.new(“Guido”)
p3 = Person.new(“Larry”)
Compare a couple of names
if p1 > p2
puts “#{p1.name}’s name > #{p2.name}’s name”
end
Sort an array of Person objects
puts “Sorted list:”
puts [ p1, p2, p3].sort
The last line:
puts [ p1, p2, p3].sort
-does not produce the desired result of:
Guido
Larry
Matz
-instead it produces: name
name
@name
The fix is as follows:
puts [p1.name, p2.name, p3.name].sort
Great book, by the way!
Thank you.
Matej,
429
ERROR
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.
44
TYPO
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, Sharing Functionality: Inheritance, Modules, and Mixins, on page 69.
I could not find a definition of what class methods are. The only references to class methods in Chapter 5 are located in page #74:
The method definitions look similar, too: module methods are defined just like class methods.
and on page #75:
As with class methods, you call a module method by preceding its name with the module’s name and a period, and you reference a constant using the module name and two colons.
If this made you think of class methods, your next thought may well be “What happens if I define instance methods within a module?”
This, however, does not explain what class methods are.
103
TYPO
I put “typo” but I’m not sure its a typo.
For \\s, the first line is:
(?a), (?d) → [␣\\t\\r\
\\f] (?a), (?d) → [0-9]
I get this much: (?a), (?d) → [␣\\t\\r\
\\f]
but why is this: (?a), (?d) → [0-9]
added to the first line?
316
SUGGEST
The information under “Regular Expression Patterns” (under “The Basic Types” under chapter 22 “The Ruby Language” should be a table. Also, there should be a list of tables in the table of contents. If you have figures, a list of figures should be in the TOC as well.
It takes me forever to find what I’m looking for when I’m looking for regular expression fine details. I know it is in the book but is it up in chapter 7 or is it down in chapter 22? The book has always felt bipolar to me. Each topic is touched on several times and it is hard to go back and find things. To rephrase, it is ok as a book book (but I wonder if anyone really sits down and reads it cover to cover) and its weak as a reference book. It appears to try to be both and suffers a bit as a result.
If you want Part III to be a reference then it needs to be a complete reference either repeating information from parts I and II or linking to it. In today’s example, I’m trying to understand (? …). Chap 22 has only “Name the string captured by the group”. Chap 7 has examples. But it has many oddities which are not captured in one place. Sometimes it creates local variables; sometimes not. etc.
I need an algorithm to find what I’m looking for. The proposed algorithm in this case would be: go to the list of tables, find the table with regular expressions, click there. Find the particular pattern of interest in the table. Click on it. And that would take me to the nice readable discussion that you typically have up in chapter 7 or somewhere other than part III.
64
SUGGEST
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).
47
ERROR
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) queue.
queue = []
queue.push “red”
queue.push “green”
queue.shift # => “red”
queue.shift # => “green”
Don’t you mean “unshift” and “pop”?
Here’s my code
p queue = [] # => []
p queue.unshift “red” # => [“red”]
p queue.unshift “green” # => [“green”, “red”]
p queue.unshift “blue” # => [“blue”, “green”, “red”]
p queue.pop # => “red”
p queue.pop # => “green”
p queue.pop # => “blue”
122
ERROR
“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 think it’s an error to say that key => value pairs must precede a splat argument. The splat argument must come before key => value pairs.
808
TYPO
The last sentence of the leading paragraph of the Standard Library description for StringIO on p.808 should read:
StringIO objects take their encoding from the string you pass in, or the default external encoding when no string is passed in.
32
TYPO
In BookStock the method to_s is defined but not called.
16
SUGGEST
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 to Ruby / programming, especially since the three first lines will produce the expected output. Maybe use a functional example here?
n/a
ERROR
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 information of the printed copy is missing (which may be intentional). I found it impossible to correctly tap a link on the Kindle Paperwhite. On keyboard based devices, it is possible to actually “grab” a link despite the lack of formatting. Please address this issue a.s.a.p because the ability to navigate the reference section depends on it.
pre
TYPO
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 adds ‘(4th edition)’ and that is nowhere seen in the PDF…
84
TYPO
2nd line of Rational example should show result # => (1/3)
301
TYPO
classStringon page 666.
The Basic Types • 301
Rather, ‘class String on page…’
453
TYPO
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?( other ) → true or false
742
TYPO
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 “Hello Kitty” line lacks the “nil” value for the fourth “special” column such that its fourth value lines up in the “special” column and it lacks a fifth value for ‘in_stock’. Solvable by including a trailing ‘,’ symbol in the ‘sl_csv/csvfile_hdr’ file?
45
SUGGEST
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 not autovivify that array element.
108
SUGGEST
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 their respective lines. (To help distinguish that these aren’t setting up a block.)
152
SUGGEST
When describing what happens with a second parameter for ‘throw’, this phrase implies we have already seen or learned about a second parameter:
“If the throw is called with the optional second parameter”
How about changing ‘the’ to ‘an’ as in:
“If the throw is called with an optional second parameter”
This might better convey that we are about to see usage of a second parameter.
192
TYPO
typo: context “and the oponent wins a point” do
s/oponent/opponent/
213
TYPO
Typo: At some point, when you finishing reading from the last file,
s/finishing/finish/
0
SUGGEST
Enumerators aren’t mentioned at all in Part 3 Ruby Crystalized.2
473
473
TYPO
In description of “one?”, change “at least” to “exactly” (or similar).
“(that is, one? will return true if {exactly}[at least] one of the collection members is not false or nil)”
150
TYPO
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 accompanying text describes “removes two routines from the backtrace by passing only a subset of the call stack to the new exception:” , but the code as listed only removes one (missing index 0 of the array only)
383
TYPO
“on page 375” should be “on page 376”
(first line after Hook Methods)
199
TYPO
typo: “This may be incompatibile with older code.”
s/incompatibile/incompatible/
28
SUGGEST
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 arguments are present i.e. that to guarantee reading from stdin $stdin.gets should be used whereas plain gets is a reference to Kernel#gets. Alternatively ARGV should be emptied for example by ARGV.clear. In fact it might be a good idea to have an early section called “Gotchas for Experienced Programmers”
50
ERROR
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 the contents of counts and sorted as displayed by puts.
59
45
ERROR
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-negative integer index.” we miss the negative indexes of arrays, that allow the backward access to the collection.
36
TYPO
In the def statement for the price_in_cents method, price should be @price
47
TYPO
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 classArrayon page 421.”
48
TYPO
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 by classHashon page 521.”
72
SUGGEST
Update:
GServer is discontinued as part of the Std. Lib. and must be installed as a gem.
53
ERROR
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-darwin14.4.0])
The code in section 4.2 (Hashes) should be changed from
require_relative ‘words_from_string’
require ‘minitest/autorun’
class TestWordsFromString < Minitest::Test
Thanks for a very good book.
325
SUGGEST
The following is an error:
def meth(first = 12, second, third = 13)
…
end
It appears that the optional arguments may be at the front, middle, or end but they must all appear together… I’m guessing.
Around the area of the paragraph that starts “Arguments without default values may appear after arguments with defaults”, you might add this tidbit (if indeed it is true). I’m testing on Ruby 2.2.3.
312
ERROR
On Table 14, “\\#{code}” should be “#{code}”.
332
TYPO
Under “Ranges in Boolean Expressions”, expr2 is not shown in the code example. It probably should be “expr1 .. expr2”.
332
ERROR
On “Ranges in Boolean Expressions”, point 2.
“if expr2 is not true” should be “if expr2 is true”.
In class Mutex, all methods are marked as “New in 2.0”. In fact, all of them are present already in 1.9.3.
34
TYPO
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 not showing, so the correct way of spelling it would be:
BookInStock b = new…
315
ERROR
In Ruby (at least in 2.3.1), `DATA` is not a global variable.
35
ERROR
In Virtual Attributes:
def price_in_cents
Integer(price*100) + 0.5)
end
should probably be:
def price_in_cents
Integer(@price*100) + 0.5)
end
The same thing happens on the next page, page 36.
853
ERROR
Important reference to PREPEND missing in the index from PDF page 368 top of page
and 399 third paragraph line 4 :
as one in the host, the host method would be called. Ruby 2 adds the prependmethod
213
ERROR
In argf section it should be argf.file.lineno instead of argv.file.lineno no?
218
ERROR
If you’re running gem install on a Unix platform and you aren’t using rvm, you’ll need to prefix the command with sudo, because by default the local gems are installed into shared system directories.
This is wrong, depends on distribution. Eg. Archlinux defaults to user home.
429
ERROR
Missing entry for Array method first.
297
ERROR
The multi-line expression for evaluating e = 8 + 9 + 10 claims the backslash is needed to continue on the newline. This is no longer the case in Ruby 1.9+. The multi-line expression for e works without the backslash.
297
ERROR
Apologies, I made a mistake with my last report on multilines and backslashes and the e expression for page 297/298/299?, it was incorrect. Please ignore. The book is correct.
135
SUGGEST
passing hash arguments without braces cannot be place before splat. If no braces, it should be place only at the last.
202
TYPO
Opponent is misspelled in the context “and the oponent wins a point”. (Alternately, just change to “receiver” to be consistent with the terminology used in the other tests)
425
ERROR
There is no mention of method Array#clear. It is used in the GetOptLong example on page 761 of the PDF. But it’s not mentioned in the description of class Array on page 425.
131
ERROR
The class List under “Other Forms of Assignment” throws an error “TypeError (no implicit conversion of Integer into Array)”, when adding a number for the second time, it works only for the first time.
irb(main):009:0> li = List.new(1,2,3,4)
=> #<List:0x0000000002fb7a78 @list=[1, 2, 3, 4]>
irb(main):010:0> li +(5)
=> [1, 2, 3, 4, 5]
irb(main):011:0> li +(6)
=> [1, 2, 3, 4, 5, 6]
irb(main):012:0> li +(7)
=> [1, 2, 3, 4, 5, 6, 7]
irb(main):013:0> li += 8
=> [1, 2, 3, 4, 5, 6, 7, 8]
irb(main):014:0> li += 9
Traceback (most recent call last):
3: from C:/Ruby25-x64/bin/irb.cmd:19:in `
’
2: from (irb):14
1: from (irb):14:in `+’
TypeError (no implicit conversion of Integer into Array)
Note that (other) works, but= works only for the first time.
The problem is, once we do li which is of class List is changing to Array, once we do += for the first time:
irb(main):009:0> li = List.new(1,2)
=> #<List:0x00000000034194e0 @list=[1, 2]>
irb(main):010:0> li.class
=> List
irb(main):011:0> li += 3
=> [1, 2, 3]
irb(main):012:0> li.class
=> Array
irb(main):013:0> li += 4
Traceback (most recent call last):
3: from C:/Ruby25-x64/bin/irb.cmd:19:in `
’
2: from (irb):13
1: from (irb):13:in `+’
TypeError (no implicit conversion of Integer into Array)