Take the following snippet:
module SomeModule
class SomeClass
SomeConstant = 3.1415
end
end
var = "SomeModule::SomeClass"
print(var::SomeConstant)
This raises TypeError. So far, the only way I've found to do this (and
let me warn you, I'm quite new to Ruby so I may just be missing
something right in front of me) is like this:
var = "SomeModule::SomeClass"
eval "var = " + var
print(var::SomeConstant)
which does indeed work, but I figure there has got to be a better way
than using eval.