Re:New Ruby 1.9 Features, Tips & Tricks
by farrel on Monday February 21, 2011 @03:24PM
(#2246997)
Proc#=== allows you to do this:
Basically you can now run code when checking case equality (===).
[ Parent
| on HN ]
Re:New Ruby 1.9 Features, Tips & Tricks
by petercooper on Monday February 21, 2011 @08:06PM
(#2248126)
Since we're talking Ruby 1.9 here, that code won't even run :-( .. drop the colons and you're good though! :-) But if we're really talking Ruby 1.9, you could also go with:
->(x){ x % n == 0 }