A Workaround To A Near Miss Part II
Following on from my previous
article here’s a slightly neater way to combine Proc#=== and
Symbol#to_proc. No special functions required.
1 case number 2 when lambda( &:even? ) 3 puts "Even!" 4 when lambda( &:odd? ) 5 puts "Odd!" 6 when lambda( &:zero? ) 7 puts "Zero!" 8 end
Farrel Lifson is a lead developer at Aimred.