q1xlbg
Last Updated: February 25, 2016
·
556
· kormie

Enumerable#partition

Ever want to do a select and reject at the same time? Use partition. Here's a super fast way to get all the evens and odds from 1 to 100.

even, odd = [*1..100].partition(&:even?)