Showing posts with label enumerables. Show all posts
Showing posts with label enumerables. Show all posts

Tuesday, 12 July 2016

Select Map

Difficulty:
Easy

Tags:
enumerables, procs

Instructions:
The Pattern object not only functions as a Regexp. For example, check out what happens if you do Pattern === element. This problem demonstrates that using a Pattern with #grep will work much like using select and map in combination.

Problem and Solution:

Each With Object

Difficulty:
Easy

Tags:
ruby 1.9, enumerables

Instructions:
ne of our favorite methods in Ruby 1.9 is each_with_object. It works much like inject. Use each_with_object to return an array containing one reversed string for each string that has an even number of characters.

Problem and Solution: