From: Tiziano Merzi Date: 2008-01-04T21:23:02+09:00 Subject: Re: With statement Lars wrote: > On Jan 4, 11:51 am, ole __ wrote: >> I'm pretty sure ruby doesn't have a with statement. Is it possible to >> emulate one? > > Yes: > Or class Object def with(&b) instance_eval(&b) end end #Usage: class Foo def dostuff puts "doing stuff in Foo" end end foo = Foo.new foo.with do dostuff end Tiziano -- Posted via http://www.ruby-forum.com/.