Array and Hash blog

6.16.2015

An enumerable is a "collection" in ruby, with the qualification that a .each method has been specified. This .each method is important to understanding what the method map does and how it ties in to being an enumerable. The map method basically takes an enumerable object and a block and does that block for each element of the enumberable. The difference between map and each is map is very useful for changing the data of the enumerable itself while each is more to iterate through the data for some external purpose. Note that calling .map on an enumerable will return an array, not an enumerable.