Here map
is defined on any class which mixes in Enumerable
.
It will be called on self
from any Enumerable
object, when you call object.concurrently { |x| # whatever }
and the use of it is that it will spawn a large number of threads to evaluate the blocks.
Further, using map
in the pattern from the book, means that you get the same behaviour as Enumerable#map
with whatever additional effect is used before, around and after the yield
. In this case, that is starting each block evaluation in its own thread.