A
Alexandre Mutel
I'm trying to get a constant inside a class (but i have to do it outside
the declaration)
module A
class B
end
class C
end
end
How to get constant B from inside C but executed from outside first
declaration?
After module A is declared, trying :
failed and const_get is not working too.
But if i do something like this:
module A
class B
end
class C
$test_binding = binding
end
end
puts eval("B",$test_binding)
it's working... Is using the binding is the only way to get correct
scope and resolve constant correctly from inside class C?
the declaration)
module A
class B
end
class C
end
end
How to get constant B from inside C but executed from outside first
declaration?
After module A is declared, trying :
failed and const_get is not working too.
But if i do something like this:
module A
class B
end
class C
$test_binding = binding
end
end
puts eval("B",$test_binding)
it's working... Is using the binding is the only way to get correct
scope and resolve constant correctly from inside class C?