From: Joel VanderWerf Date: 2007-02-12T12:59:22+09:00 Subject: Re: Backport from ruby 1.9, including constants 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). module Constants TEST = 5 end class A end a = A.new m = Module.new def m.const_missing k Constants.const_get(k) || super(k) end string_from_file = < 5 -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407