From: Ken Bloom Date: 2007-02-12T10:10:06+09:00 Subject: Re: Backport from ruby 1.9, including constants 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 -- Ken Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/