From: mental@... Date: 2005-12-09T00:49:08+09:00 Subject: Re: A small query Quoting James Edward Gray II : > On Dec 8, 2005, at 9:23 AM, Douglas Livingstone wrote: > > > def with(obj, &block) > > obj.instance_eval(&block) > > end > > > > class Foo; def bar; puts 'rab'; end; end > > > > foo = Foo.new > > > > with foo do > > bar > > end > > Ah yes. This actually does what you asked for. Ignore my > incorrect attempt. In either case, caveat nuby -- within the block 'self' will refer to foo, and any instance variables will be foo's. That's probably just a bit more agressive than the OP had in mind for 'with'. -mental