261484 (14) [Avatar] Offline
#1
Not sure if this is the right place for submitting notes or corrections..

Just in case this is the right place, there you go:

Page 56 of MEAP (30/3/2018) update:

def ticket.details(*x)
x.each { |detail| puts “This ticket is #{detail} }
end

There is a missing double quotation mark

Should be:

def ticket.details(*x)
x.each { |detail| puts “This ticket is #{detail}" }
end

I will post more if I am in the right place..!

Cheers
468472 (2) [Avatar] Offline
#2
Yes! This is a great place for recording errata. Thank you for pointing this out. It will help to make the book cleaner.

If you find any other issues I'm happy to review them.

Thanks again,

Joe
261484 (14) [Avatar] Offline
#3
Not a typo, but an unpleasant part described in an unpleasant way:

Page 84:

THE CLASS/OBJECT CHICKEN-OR-EGG PARADOX

"""
The class Class is an instance of itself—that is, it’s a Class object. ... Object is a class but classes are objects. So, Object is an
object. And Class is a class. And Object is a class, and Class is an object.

...


The best way to deal with this paradox, at least for now, is to ignore it.
"""

I understand it is not the easiest thing to explain, but it is also not made any easier this way, do you agree ? Is there a way to provide better explanation that does not further confuse the reader? I am afraid this may push away people from using Ruby..

** Note: Since I am not a native English speaker, I may be wrong, but I would redo this part.. I can provide an example if you like. Or if you can provide an alternative to this, it would be great.
261484 (14) [Avatar] Offline
#4
One more note (page 85):

tickets.max_by(&:price)


The &:price was not explained, I think it should
261484 (14) [Avatar] Offline
#5
page 147:

Just a personal opinion, the class car should be presented before using it, since all its components are already discussed before (nothing new there..)
468472 (2) [Avatar] Offline
#6
Thank you, thank you! All of your suggestions have been helpful and I will make changes as necessary.

For the explanation of the class Class, I agree that this can be confusing. I will try to find a better way to explain it.

The other suggestions are well-received and will be made to the final draft.

Please keep your feedback coming!
261484 (14) [Avatar] Offline
#7
Will do !


Thank you for your patience smilie


Cheers
Maksim
261484 (14) [Avatar] Offline
#8
Page 178

"""
=> 1the a += 1 statement won’t be executed, because true is already true. But in this case

"""

Just a typo
261484 (14) [Avatar] Offline
#9
Page 184:

running listing 6.4 in a file or within irb does not provide the listed output...

using a file:

c = 0
until c == 5...
I am on iteration 0!
I am on iteration 1!
I am on iteration 2!
I am on iteration 3!
I am on iteration 4!
5

using irb:

>> class Integer
>> def my_times
>> c = 0
>> puts "c = 0"
>> puts "until c == #{self}..."
>> until c == self
>> yield (c)
>> c += 1
>> end
>> self
>> end
>> end
=> :my_times
>>
?> ret = 5.my_times {|i| puts "I am on iteration #{i}!"}
c = 0
until c == 5...
I am on iteration 0!
I am on iteration 1!
I am on iteration 2!
I am on iteration 3!
I am on iteration 4!
=> 5


But the book says:

c = 0
until c == 5...
I'm on iteration 0!
I'm on iteration 1!
I'm on iteration 2!
I'm on iteration 3!
I'm on iteration 4!5

I am on iteration 0!
I am on iteration 1!
I am on iteration 2!
I am on iteration 3!
I am on iteration 4!
=> 5

Maybe all typos that need some fixing in pages 184 and 185
261484 (14) [Avatar] Offline
#10
Just a note:

Page 195:

def open_user_file
print "file to open: "
filename = gets.chomp
fh = File.open(filename)
yield fh
fh.close
rescue
puts "could not open file!"
end

For someone new to ruby, it would worth to put an example on how this would be run...

I would try to just call open_user_file and get error due to a missing block for the yield..

So an example call would be useful.. I tried something like: open_user_file {|line| puts line.read }

P.S. I am new to ruby.. I might be wrong..
261484 (14) [Avatar] Offline
#11
Page 198, in the sample code:

def line_from_file(filename, substring)
fh = File.open(filename)
begin
line = fh.gets
raise ArgumentError unless line.include?(substring)
rescue ArgumentError
puts "Invalid line!"
raise
ensure
fh.close
end
return line
end

Probably this should be called check_first_line instead of line_from_file ?

If I am not mistaken, this example gets the first line from the file and raises an error if the line does not include the supplied sub-string.. so the method name should probably be more descriptive..
261484 (14) [Avatar] Offline
#12
Page 208-209: 7.2.2 Customizing unary operators

The reader will notice that to define unary operator + and - you use +@ and -@ while in the method definition for the negation, you simply do a "def !"

It is worth explaining why we added @ in case of def +@ and def-@ and did not add it in case of defining the negation method.
261484 (14) [Avatar] Offline
#13
The Well-Grounded Rubyist, Third Edition MEAP Update (19/5/201smilie:

A typo on page 235:

"Try typing these statements into an irb session using irb –simple-prompt –noecho for clarity."

The command switch would not work this way, it should be:

--simple-prompt --noecho


Maksim
261484 (14) [Avatar] Offline
#14
The Well-Grounded Rubyist, Third Edition MEAP Update (19/5/201smilie :

Page: 267

>> d = Date.today
=> #<Date: 2018-01-15 ((2458134j,0s,0n),+0s,2299161j)>
>> puts d.next2018-01-16
>> puts d.next_year2019-01-16
>> puts d.next_month(3)2018-04-15
>> puts d.prev_day(10)2018-01-05

Looks like a typo or a formatting error..
261484 (14) [Avatar] Offline
#15
The Well-Grounded Rubyist, Third Edition MEAP Update (19/5/201smilie :

Page: 267:

>> d.upto(next_week) {|date| puts "#{date} is a #{date.strftime("%A")}" }2018-01-15
is a Monday
2018-01-16 is a Tuesday
2018-01-17 is a Wednesday
2018-01-18 is a Thursday
2018-01-19 is a Friday
2018-01-20 is a Saturday
2018-01-21 is a Sunday
2018-01-22 is a Monday

Looks like a typo or a formatting problem.. Was the editors too rushed to push chapter 8 ? smilie
261484 (14) [Avatar] Offline
#16
The Well-Grounded Rubyist, Third Edition MEAP Update (19/5/201smilie :

Page: 274:

THE %W AND %W ARRAY CONSTRUCTORS

Typo: (one w should be capitalized, while the other not).

That is caused by trying to capitalize all the time even when talking about method names or other constructs that are not capitalized. (There are many examples of that throughout the book).

Just to save an extra message, same applies for:

THE %I AND %I ARRAY CONSTRUCTORS on page 275.