From: Michael Linfield Date: 2008-05-13T04:48:21+09:00 Subject: Re: Constants, Bindings and instance_eval Achim Passen wrote: > Dear rubyists, > > i'm fairly new to ruby, so please apologize if i'm missing something > obvious. I'm trying to figure out how constant lookup works and find > myself confused. Here we go: > > class A; C=3 end > > $a = A.new > $a.instance_eval "C" # => 3 > $a.instance_eval {C} > # ~> NameError: uninitialized constant C [...] > > Can anybody shed some light on this? Thanks a lot! > > Kind regards, > achim class A C=3 end $a = A.new $a.instance_eval "C" #=> 3 $a.instance_eval {C} # ~> NameError: uninitialized constant C [...] Its not being called properly for 1.8 instead use this... $a.instance_eval {A::C} A being the class, and C being the constant. Regards, - Mac -- Posted via http://www.ruby-forum.com/.