From: Florian Gilcher Date: 2009-06-17T07:01:24+09:00 Subject: [ruby-core:23880] Re: instance_eval no longer yielding self in ruby 1.9 On Jun 16, 2009, at 10:47 PM, apeiros wrote: > > So I define the method conditionally like: > if method_defined? :instance_exec then > def ...; instance_exec(self, &block); ...; end > else > def ...; instance_eval(&block); ...; end > end > > ? > > I don't know, but I find that solution somewhat ugly. The > alternative is to have no 1.8 compatibility which is right now not > too nice. > > Regards > Stefan Rusterholz > There are instance_exec-Implementations in 1.8.x, for example the one from facets: http://facets.rubyforge.org/doc/api/core/classes/Object.html#M000242 So usually, I do something like this: unless Object.respond_to? :instance_exec require 'instance_exec' end Regards, Florian -- Florian Gilcher smtp: flo@andersground.net jabber: Skade@jabber.ccc.de gpg: 533148E2