The map enumerable method takes an object and a block and returns a new array with the results of running the block for each element. It leaves the original object unchanged unless you use map!. It’s different from each because each only performs the block for each element in the object, while map performs the block and returns an array containing the results.
Here’s an example of how map works:
[3, 5, 7, 8].map { |i| i+3 } #=> [6, 8, 10, 11]