How to Use Ruby's Map Method
The map method is a non distructive enumerable method of Ruby's Array class or Enumerable#map in Rubyese. In a nutshell it will iterate over each element in an array and perform a function on each of these elements. It also has a corresponding destructive version Enumerable#map! if you need to change the original array and have it returned instead of returning a new one. It is a really handy method when you want to do 'something' to each element of an array. Take a look at the following examples to see what I mean.
That's it! A very simple yet powerful method to use anytime you need to do 'something' to each value within an array.