Ruby Debugging Map Blocks
The thing to remember is that map operates on each element of the collection for each run of the block. When debugging, you want to see how the block operated on each element.
It is important to save the result in a local variable so that you can return it as the last statement of the block. If you don’t, the result of the puts statement will be returned (usually nil).
comments powered by Disqus