Head First Ruby

Errata for Head First Ruby

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
Page 104
First code block

"#{@name} the dog, age #{age}" #{age} must be #{@age}

Note from the Author or Editor:
The code actually works as printed, because it calls the "age" attr_reader method inherited from the Animal class. But this is indeed a typo; I intended to access the @age instance variable just as I did with the @name instance variable.

Martin Reijinga  Jan 29, 2016 
Page 147
Figure at the bottom, right of the page

There is a figure that appears to be a reference figure left in by mistake. No text refers to it, and it has nothing to do with the context of the text on the page. It contains the following text: down_arrows short_downward_arrows downward_arrow horizontal_arrow upward_arrow up_arrows And it has arrows pointing to it from all sides. The figure does no damage to the text or the topic under discussion. It just looks random.

Note from the Author or Editor:
The referenced figure is a template item accidentally left in during the layout process. It should be removed.

Brad Collins  Feb 06, 2016 
Page 157
Code after 3rd paragraph

Previously, we declared this array: prices = [2.99, 25.00, 9.99] Then, we want to print out the array contents using the 'puts' method, but the ebook shows wrong array contents: puts prices[0] /=> 3.99 puts prices[2] /=> 25.0 puts prices[1] /=> 8.99 The correct text should be this: puts prices[0] /=> 2.99 puts prices[2] /=> 25.0 puts prices[1] /=> 9.99

Note from the Author or Editor:
The displayed output is indeed incorrect, but the corrected output submitted by the reader is in the wrong order. The corrected text should be: puts prices[0] /=> 2.99 puts prices[2] /=> 9.99 puts prices[1] /=> 25.0

Eder Andrés Ávila Niño  Jan 24, 2016 
Page 165
Second paragraph

The first line of the paragraph reads: "...the logic in total, refund, and show_variables..." and it should read: "..the logic in total, refund and show_discounts..."

Note from the Author or Editor:
Confirmed. Text should be changed as described by submitter.

Stephen Grell  Mar 20, 2016 
Page 194
Content of

Throughout the chapter, the text "Truncated is funny: it can't..." within the "reviews.txt" sample file should be listed as "Truncated is funny - it can't..." (with a space-dash-space instead of a colon). As it appears now, the final result ends up appearing as: "The critics agree, Truncated is:\n'Amazing'\n'Funny:'\n'Astounding'", with a colon following one of the adjectives. Content originating from the "reviews.txt" file needs to be changed on the following pages: 194 201 202 203 212 Thanks to Caleb Engelken for submitting this!

Jay McGavren
Jay McGavren
Jun 02, 2016 
Page 365
Graphic just before "The real problem here is ..."

There is a graphic labeled, "Can we even eat these?" with a curly brace. The graphic and its text of the graphic appears in the PDF version: Turning oven off. Serving You need to turn the oven on first!. Serving You need to turn the oven on first!. Serving You need to turn the oven on first!. The graphic appears to be missing from the ePub version. The label and the curly brace are there, but the graphic containing the puts output does not appear in my reader.

Note from the Author or Editor:
I believe the reader may have meant to reference page 361 of the print/PDF version as the place the output text appears correctly, not page 365. Confirmed that the output text box containing "Serving You need to turn the oven on first!." (etc.) is missing from page 568 of the ePub version.

Brad Collins  Feb 22, 2016 
Page 394

On this and all subsequent code listings for Chapter 13, the Minitest::Test class is used. This works fine in Minitest 5.0 and later, but in Minitest 4.3.2 (which is included with Ruby 2.0), the class's name is Minitest::Unit::TestCase. References to Minitest::Test result in a NameError, as that class does not exist in Minitest 4.3.2. The solution is to install a later version of Minitest, by running "gem install minitest" at a system command prompt.

Jay McGavren
Jay McGavren
Dec 09, 2015  Dec 11, 2015
Page 429
"There are no dumb questions" section

sinatra myserver.rb -p 8080 would cause Sinatra to listen on port 8080 should be: ruby myserver.rb -p 8080 would cause Sinatra to listen on port 8080

Note from the Author or Editor:
Command text should be modified as described by submitter.

Anonymous  May 27, 2016 
Page 6037
2nd paragraph

Kindle edition, location 6037 of 9874. At the end of the paragraph just above the section labelled "Ensuring the oven gets turned off", there is a trailing "An" that should be removed.

Note from the Author or Editor:
This issue appears to be exclusive to the .mobi version, as it does not occur in the .pdf or print versions. The last sentence prior to the "Ensuring the oven gets turned off" section should be changed from this: "An" To this: "An ensure clause is a great place to put this sort of code." ...with the word "ensure" in the code font.

Anonymous  Jan 11, 2016 
Page 6079
"Relex" sidebar heading

"Relex" sidebar heading in "The Ruby standard library" section should say "Relax". .mobi location 6079 of 10423. This typo occurs only in the .mobi version, not the PDF or print versions.

Jay McGavren
Jay McGavren
Jan 11, 2016