Tag Archives: enumerable

Enumerable Anti-Patterns

Enumerable methods are one of my favorite parts of Ruby. Enumerable anti-patterns, however, can make things not-so-fun. Let’s explore some ways these helpful tools are abused, and how to fix them. Enumerable anti-patterns #1: Don’t use a shovel as a … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Shorten Map and Each Commands

Or: Pithy Procs for Working with Enumerables Typing out code blocks every time you want to use map or each is a bit of a pain, and often unnecessary. You may know that (1..5).map { |n| n.to_s }  can be rewritten as  (1..5).map &:to_s. But what … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment