Tue Dec 6
#
#rails-core
10:42 PM < htonl> posts about walmart, you're being assimilated rapidly
10:43 PM < nextangle> dude, I bought a car that had a gas guzzler tax on it.. I am assimilated :)
10:45 PM < htonl> before you know it you'll be 300lbs and mcdonald's customer of the year
10:47 PM < nextangle> I HAVE A BOTTLE OF EVIAN ON MY DESK! So I'll forever be young and handsome.
10:48 PM < htonl> i have a bottle of motrin on my desk
#
Those that match criteria in the block are filtered into the first element of the result, while those that don’t match are filtered into the second.
Tip Enumerable#partition
“partition” is an infrequently-used but handy method from Ruby’s Enumerable module. If you want to divide an Enumerable thing into two groups based on a set of criteria:
ppl = %w(Sam Patrick Marcel Chad)
short_names, long_names = ppl.partition{|p|
p.length <= 4
}
- [[“Sam”, “Chad”], [“Patrick”, “Marcel”]]
Those that match criteria in the block are filtered into the first element of the result, while those that don’t match are filtered into the second.