Errata

Ruby Pocket Reference

Errata for Ruby Pocket Reference

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 38
3rd paragraph

The sentence:

"Be aware that if you use a variable name that already exists in the containing scope, the block assigns that variable each successive value, which may or may not be what you want."

Should read:

"Be aware that, previous to 1.9, if you use a variable name that already exists in the containing scope, the block assigns that variable each successive value, which may or may not be what you want."

Note from the Author or Editor:
This is correct. Change the paragraph to read: "Be aware that, previous to 1.9, if you use a variable name that already exists in the containing scope, the block assigns that variable each successive value, which may or may not be what you want."

Mike Fitzgerald  Sep 02, 2015  Oct 23, 2015
Other Digital Version
42
"Negation" paragraph

Under "Conditional Statements", "The if Statement", then "Negation", the text says :

"The negation operator ! reverses the true/false value of its expression:", which is true, but then give these two examples:

"if !x == y then puts 'x does not equal y' end"

and

"if !x > y
puts 'x is not greater than y'
end"

These two examples are wrong and false. The operator ! has the highest precedence, so it only applies to x in both examples.

The examples would be valid only if

1) parentheses would be added, like "if !(x == y)" and "if !(x > y)", or

2) the 'not' operator would be used, like "if not x == y" and "if not x > y"

as, contrary to the ! operator, the "not" operator has the lowest precedence.

Note from the Author or Editor:
On page 42, add parentheses to:

if !x == y then puts 'x does not equal y' end

change to

if !(x == y) then puts 'x does not equal y' end

and change

if !x > y
puts 'x is not greater than y'
end

to

if !(x > y)
puts 'x is not greater than y'
end

Anonymous  Mar 16, 2016 
Other Digital Version
64
Paragraph above Table 1-8. Files modes

The text says:

"The first argument to 'new' names the new file 'file.rb', and the second argument specifies the file mode: 'r' for readable, 'w' for writable, or 'x' for executable."

'x' is not even a valid value for the 'mode' parameter (see table 1-8, or ruby documentation).

Note from the Author or Editor:
This is correct. The paragraph should now read exactly like this:

The first argument to new names the new file file.rb, and the second argument specifies the file mode. The effects of the different modes are shown in #file_modes.

Anonymous  Mar 16, 2016 
PDF, ePub
Page 167
Second code example, top of page, definition of month_list

In the example defining month_list, there is an extraneous extra quote. :oct"=>"October" should not have the quote after :oct and should read :oct=>"October". This is likely in the printed version too.

Note from the Author or Editor:
Correct. On page 167, delete the double quote following :oct—

:oct" => "October",

should be

:oct => "October",

Matthew Halverson  Feb 24, 2016