From: Brian Candler Date: 2004-09-30T20:38:38+09:00 Subject: Re: Funtionality of 'case'-Expression On Thu, Sep 30, 2004 at 04:25:03PM +0900, Ralf M?ller wrote: > 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 How about: def with(obj,&blk) obj.instance_eval(&blk); end ... with(object) do if method == 'whatever' then ... elsif id%2 == 0 then ... end end Regards, Brian.