From: LAMBEAU Bernard Date: 2009-01-08T23:14:21+09:00 Subject: Re: Does instance_eval passes self as block argument? Ok, it works in Ruy 1.8.7 but not in Ruby 1.9. Is there another way to do so? blambeau On Thu, Jan 8, 2009 at 3:12 PM, LAMBEAU Bernard wrote: > Ruby's documentation of instance_eval shows the "signature" of instance_eval as: > > obj.instance_eval {| | block } => obj > > I assume that the block should not take any argument. However, if I > write the following code: > > class A > def sayhello(who) > puts "hello #{who}: #{object_id}" > end > end > > A.new.instance_eval do |who| > sayhello("me") > who.sayhello("who") > end > > it prints "hello me: -605850598" then "hello who: -605850598" > > Is is guaranteed to work?? > > blambeau >