Remember that training scene in The Karate Kid? No, not the one with Jaden Smith. The 1984 original with Ralph Macchio. Mr. Miyagi takes Daniel-san outside to the parking lot of cars and tells him: First wash. Then wax: wax on, left hand, wax off, right hand. Daniel-san had to do this for each and every car in the lot.

Next day, to the backyard deck with hand-held sanders: Right circle. Left circle. Right circle. Left circle. BREATHE IN, BREATHE OUT. Daniel-san had to do this for each and every wooden plank on the deck.

And finally, a day later, to the fence (both sides!) with a paintbrush: Wrist up. Wrist down. Up. Down. DON'T FORGET TO BREATHE. For every wooden board of the fence, Daniel-san did this.

Thus was the Karate Kid's now-legendary training: a set of karate instructions, unbeknownst to Daniel-san, done for each and every object in a collection: cars in a parking lot, wooden planks of a backyard deck, and wooden boards of a fence.

As you well know, after his training, Daniel-san goes on to win the tournament, got his leg swept, won the respect of his enemies, the heart of a girl, and the pride of his teacher-- with a crane kick or two thrown in there. That's the story we love, but there's a dirty secret that no one likes to talk about: Mr. Miyagi got Daniel-san to do a bunch of awesome stuff on his collection of things for free.

In Ruby, you are Mr. Miyagi and Enumerable is your Karate Kid. And you too can make Enumerable do a bunch of awesome stuff for you on your collection of things. Ruby's Enumerable methods will apply your set of instructions-- or block of code, in Ruby lingo-- to each object in your collection. Instead of the cars in a parking lot or anything like that, your collections will likely be the objects in an Array or Hash. And that's the simple conceptual idea behind Ruby's Enumerable.

Let's look at one specific method: Enumerable#map. I think of map as the transformational Enumerable method, capable of transforming each and every object in the collection. And if we've learned anything from the Jenny Jones makeovers, transformations can be powerful. For example, what if we had an array of a million numbers and wanted to add 7 to every one? A million numbers to increase is no joke. But with Enumerable#map it totally is! Below is an example of Enumerable#map in full effect:

Okay, that's not an array of a million numbers (that would make for a very long blog post). But the principle is the same: Enumerable#map would apply the instruction-- number + 7, in this case-- to each and every number in the array, whether it's fourteen as shown or a million. On any type of Ruby collection. However big your collection. No mercy! Let's see Daniel-san do that.

Your new All-Valley Karate Tournament Champion: Enumerable!