From: Brian Adkins Date: 2007-11-21T23:50:14+09:00 Subject: Re: is there an nicer way for this expression? On Nov 20, 10:34 pm, Peņa, Botp wrote: > From: Trans [mailto:transf...@gmail.com] > # case foo.bar when 1,2 then > > hmm ;-) > > bar > #=> 1 > bar.in? 1,2 > #=> 0 > bar.in? 1,2,3 > #=> 0 > bar.in? 2,1,3 > #=> 1 > bar.in? *[2,1,3] > #=> 1 > bar.in? [2,1,3],1,2 > #=> 1 > [2,1,3].in? [2,1,3],1,2 > #=> 0 > [2].in? [2,1,3],1,2 > #=> nil > {1=>2}.in? [2,1,3],1,2,{1=>2},{2=>4} > #=> 3 > bar.in? *(1..2) > #=> 0 > bar.in? 3,4,*(1..2) > #=> 2 > bar.in? 3,4,*(2..5) > #=> nil > > aliased w among, amongst, and one_of (just lately) > > kind regards -botp class Object def equals_any *args args.each {|x| return true if self == x } return false end end