From: Chris Morris Date: 2002-06-06T09:28:45+09:00 Subject: RE: Pascal-like 'with' statement? > Is there something like Pascal's with statement? I don't think so ... > 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 How 'bout this? OpenStruct = Struct.new('OpenStruct', :host, :user, :database) Cfg = OpenStruct.new('localhost', 'shoujoai', 'shoujoai') Chris