From: Robert Klemme Date: 2004-09-30T16:50:03+09:00 Subject: Re: Funtionality of 'case'-Expression "Ralf M�ller" schrieb im Newsbeitrag news:2s1qktF1cjkj8U1@uni-berlin.de... > Salve! > > Is it possible in the 'when'-part to access components or mthods of an > object specified in after 'case' ? > > Something like: > > case object > when object.method == 'whatever' then ... > when ohject.id%2 == 0 then ... > end You can do case when object.method == 'whatever' then ... when ohject.id%2 == 0 then ... end Note the subtle difference. :-) Alternatively you can define a criterion like this: crit1 = lambda {|x| x.method == 'whatever'} class <