Jay Fields

jayfields.com
twitter: @thejayfields
github: jaycfields
linkedin: Jay Fields
instagram: jaycfields

Refactoring: Ruby Edition Errata

Despite our (Shane, Martin, Jay, and the copy editors) best care some errors always manage to get through. Please accept heartfelt apologies.

Errors in the first printing:

Page 3, the "days_rented" arrow should point to a rental, not a movie.

Pages 4, 8, 9, 14, 15, 16, 17, 18, 19, in the examples provided, there are references to Movie.NEW_RELEASE which should be Movie::NEW_RELEASE to properly scope/call the constant.

Page 7, penultimate paragraph, rental should be element. The rename from element to rental comes later in the chapter.

Page 8, 9, 14, 15, 16, 17, 18, 19, 22, 23, 26, 27, in the statement method, each.movie.title should be element.movie.title

Page 9, the amount_for method should have this_amount as the last line of the method. Without the additional this_amount the code can return nil when the inline if is false.

Page 29, the Customer class (UML) should contain total_charge, not charge

Page 30, in the html_statement method of the Customer class, each.movie.title should be element.movie.title

Page 36 & 37, In the UML, Movie and it's decendents should have the method charge(days_rented), not the attribute 'charge'.

Page 37, in the UML, "Childrens Price" should be "Childrens Movie".

Page 47, in the RegularPrice and ChildrensPrice classes, include Price should be include DefaultPrice

Page 53, both 'Tips' would likely be better shown without the word "Tip" - displayed simply as definitions instead.

Page 75, the table that's referenced isn't on the inside cover, but it is available online

Page 126, inputval should be input_val in the discount method.

Page 151, The single pipe should be || at the top and bottom of the page.

Pages 152, The single pipe should be || near the top of the page.

Page 239, UML diagram has Front Suspension Mountain Bike twice. One of them should be Full Suspension Mountain Bike instead.

Page 358, "having instances of A and A".. should be "A and B".

Formatting issues:

Page 17,
"this_amount" should be code highlighted twice in the first paragraph.
"element.charge" should be code highlighted once in the first paragraph.
"charge" should be code highlighted once in the second paragraph, after the code example.

Page 19, "element" should be code highlighted in the first paragraph.

Page 23, "total_amount" should be code highlighted in the final paragraph.

Page 26, "frequent_renter_points" should be code highlighted in the first paragraph.

Page 33, "charge" should be code highlighted in the final paragraph.

Page 43,
"charge" and "days_rented" should be code highlighted in the final paragraph.
"days_rented" should not span two lines in the sentence beginning with "I call."
"Movie" should be code highlighted in the sentence beginning with "I call."

Page 45, "Movie" should be code highlighted in the sentence beginning with "I turn."

Page 50, "frequent_rental_price" needs parentheses in the Rental box of the UML diagram.

Page 61, there is a paragraph style quotation by Dennis DeBruler. The page layout should be adjusted to display that as a block quote.

Page 73, "how" and "when" in the second sentence of the first paragraph should be emphasized or italicized.

Page 151, "search_criteria" should not have a line break after the underscore.

Page 152, "@search_criteria" should not have a line break after the underscore.

Page 180, the black box in the margin of the page is missing the "Inline Class" refactoring name.

Page 227, "off_road_ability" should not have a line break after the underscore.

Page 235, "type_code" should be bold in a few more places in the off_road_ability method.

We would also like to thank those people who have contributed corrections: A. Lester Buck III, Bryan Donovan, Katrina Owen, Michael Stalker, Nate Bibler, Sonia Hamilton.