4 Lesser Known Ways to Use Ruby’s Enumerable Module

See the original posting on DZone Python

A big reason I love Ruby is how much work I can get done in just a few characters or lines of code, and ensuring that code is still easy to read for my peers. One area where this is most apparent is in dealing with arrays and hashes, also known as enumerables in the Ruby world.

Any object that includes Ruby’s powerful Enumerable module can be iterated over, traversed, manipulated, and sliced and diced in various ways. This module’s flexibility leads to a surprisingly terse code for complex tasks.