From: LAMBEAU Bernard Date: 2009-02-13T20:06:31+09:00 Subject: Re: Instance variables on anonymous objects does not work? OK, something that I didn't catch of course. a = ... invocation is wrong. Sorry for the stupid question. blambeau On Fri, Feb 13, 2009 at 12:02 PM, LAMBEAU Bernard wrote: > Much more strange: why does this one work?? Same behavior on both ruby > 1.8.7 and ruby 1.9 > > a = Object.new > a.instance_eval do > @names = ["you", "me"] > end > def a.say_hello > puts "Hello: " << @names.inspect > end > a.say_hello > > the code prints Hello: ["you", "me"] > >