From: Ken Bloom [mailto:kbloom / gmail.com] Sent: Monday, February 12, 2007 3:10 AM >On Mon, 12 Feb 2007 09:02:37 +0900, Victor \"Zverok\" Shepelev wrote: > >> Hello all. >> >> During last several monthes I've worked on some library, using the latest >> ruby1.9. Now I want to release the library to community, but first I need >to >> "backport" it. >> One small problem I've stumbled upon: >> >> module Constants >> TEST = 5 >> end >> >> class A >> end >> >> a = A.new >> >> a.instance_eval{ >> extend Constants >> p TEST #<== here >> } >> >> At the "here" string, ruby1.9 had printed "5", but ruby 1.8.5 raises >> NameError (uninitialized constant TEST). >> >> I know, the question is silly, but I can't find how to do this. (by some >> reasons, the code should affect only one object, not entire class) > >class << a > extend Constants > p TEST >end Not exactly what I want. I need "TEST" constant to be visible inside a.instance_eval V.