Inline Enumerator Messages in Ruby
Many rubyists are familiar with the following shorthand:
This shorthand makes it easy to send each element of an enumerator a specific message.
But what if you want to send each element of your collection to a method on another object?
For example, what if you had an array of bill amounts and you wanted to map this to an array of Bill objects? You could:
The short way to do this, however, is this:
Just a cool trick!