From: LAMBEAU Bernard Date: 2009-01-09T02:04:30+09:00 Subject: Re: Does instance_eval passes self as block argument? Works under Ruby 1.8.x, not with ruby 1.9.0 (I did not try with Ruby 1.9.1, which is more stable but not available yet under Ubuntu). Did-you try under Ruby 1.9.1 ? blambeau On Thu, Jan 8, 2009 at 5:51 PM, Mike Gold wrote: > LAMBEAU Bernard wrote: >> >> I'm not sure that what I want makes sense because I've got self inside >> the block, but if anyone knows how to make this code working in Ruby >> 1.9, I'm still interested. >> > > class A > def doit(&block) > instance_eval(&block) > end > def sayhello(who) > puts "hello #{who}: #{object_id}" > end > end > > A.new.doit do |who| > sayhello("me") > who.sayhello("who") > end > > #=> > hello me: 35747370 > hello who: 35747370 > -- > Posted via http://www.ruby-forum.com/. > >