From: Gary Wright Date: 2007-11-08T04:15:52+09:00 Subject: Re: instance_eval to evaluate methods inside a block in cont On Nov 7, 2007, at 3:58 AM, Adam Anderson wrote: > From what I am reading it would seem that this is just not a > possibility, however. You could use method_missing in the implicit object to delegate the message to another object: class A def foo warn "foo in #{self.inspect}" end def backup=(b); @backup = b; end def method_missing(*args, &block) if @backup @backup.send(*args, &block) else super end end end class B def bar warn "bar in #{self.inspect}" end def with(x, &b) x.backup = self x.instance_eval &b end end a = A.new b = B.new.with(a) { foo # foo in instance of A bar # bar in instance of B }