’: uninitialized constant Router (NameError)
Suggest putting the class definition before the usage call.
By Developers, For Developers
| PDF Pg | Paper Pg | Type | Description | Fixed on | Comments |
|---|---|---|---|---|---|
| 6 | TYPO | In the line 5 code example of lambda_counter.rb, I think it should be decr = lambda { x -= 1 } instead of decr = lambda { x += 1 }. | Good catch! You're absolutely right. | ||
| 51 | TYPO | See amp; where should be & in symbol to prod example | |||
| 59 | TYPO | Exercise 2 should say to instantiate classes. The ‘to’ is missing | |||
| 59 | TYPO | Extra periods in exercise 2 at end of first sentence | |||
| 30 | ERROR | I don’t think your implementation of File#open will work as expected if the caller doesn’t pass in a block. The “ensure” clause gets executed regardless, so the method will return a file which has already been closed. I believe this version works correctly. class File | |||
| 4 | TYPO | The result of | |||
| 9 | TYPO | last para: “So yes, a lambda can most definitely be passed into a lambda.” should be “So yes, a lambda can most definitely be passed into a method.” | |||
| 10 | SUGGEST | para 3: the point of your section “First-Class Values” is lost here when you suddenly refer to them as “first-class functions”. Do you mean they are values which happen to be functions? Why then is it that “Ruby’s methods are not first-class functions”? | |||
| 36 | ERROR | In the code example “blocks/object_init_revised”, outputing “client.consumer_key” and “client.consumer_token” returns “nil”, unlike what the example shows. | The example should be instead: \n \nclient = Twitter::REST::Client.new({consumer_key: "YOUR_CONSUMER_KEY"}) do \n self.consumer_secret = "YOUR_CONSUMER_SECRET" \n self.access_token_secret = "YOUR_ACCESS_SECRET" \n self.access_token = "YOUR_ACCESS_TOKEN" \nend \n | ||
| 72 | TYPO | In the solution of the 5th exercise of Chapter 1, you wrote : reducer.call([], lambda { |acc, x| acc << x * 2}, [1,2,3,4,5]) but the second parameter is not the binary_function in the reducer example of the book. You should use the third argument as binary_function instead. This works: reducer.call([], [1,2,3,4,5], lambda { |acc, x| acc << x * 2}) | |||
| 22 | SUGGEST | one of the last example in the page explain how to pass a variable to a block without being able to modify it inside the block: x = “outside x” From what is written it seems like (at least to me) that you can access the outside x and if you try to modify it inside the block it will not have any effect to the outside one. | |||
| 48 | ERROR | first para: When Ruby sees an & and an object—any object—it will try to turn it into a block. s/block/proc/ ? | |||
| 4 | ERROR | The book shows: >> inner_lambda.call() but inner_lamda.call() returns “I will not drive the principal’s car” | |||
| 24 | SUGGEST | For the next edition, in code for blocks/fixnum_times.rb, use “Integer” since Fixnum is deprecated. | |||
| 32 | ERROR | If the class Router definition is after the block I get the following error: ruby router.rb ’: uninitialized constant Router (NameError) Suggest putting the class definition before the usage call. | |||
| 32-35 | SUGGEST | In the block call “routes = Router. new do”, on pages 32 and 33 there are two routes to match. On pages 34 and 35 there’s just one. Might be better to make them look the same. | |||
| 45 | ERROR | On this page, the proc p is defined like this: p = proc { |x, y| puts “x: #{x}, y: #{y}” } One example shows the result of calling p with 3 arguments like this: call(‘Ohai’, ‘Gentle’, ‘Reader’) The book erroneously indicates that the result is: x: Ohai, y: Gentle Reader But the result is actually: x: Ohai, y: Gentle since the third argument is silently discarded. | |||
| 6 | TYPO | re line 5 in the closures/lambda_counter.rb code snippet: ````` decr = lambda { x += 1 }` I assume the ` +` is intended to be a ` -` |