From: Christian Rishoej Date: 2002-06-06T09:43:28+09:00 Subject: Re: Pascal-like 'with' statement? > Is there something like Pascal's with statement? I'd like to turn this > code: > > Cfg = OpenStruct.new > Cfg.host = 'localhost' > Cfg.user = 'shoujoai' > Cfg.database = 'shoujoai' > > into something like this: > > Cfg = OpenStruct.new > with Cfg do > host = 'localhost' > user = 'shoujoai' > database = 'shoujoai' > end If you have class Cfg ... end ...you could do: c = Cfg.new c.instance_eval { @host = 'localhost' @user = 'shoujoai' } Christian