V
Victor \Zverok\ Shepelev
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)
Thanks.
V.
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)
Thanks.
V.