M
Martin Boese
In a program I module_eval class definitions into a dynamically created
namespace. To run support code later on I need to know the module it was
defined in from an instance of the class.
Is there any _NICE_ way to replace this 'cheat version'? The below also
doesn't work with nested modules.
module X
class A
def my_module
Object::const_get(self.class.name.split('::')[0])
end
end
end
a = X::A.new
a.my_module => X
Thanks!
martin
namespace. To run support code later on I need to know the module it was
defined in from an instance of the class.
Is there any _NICE_ way to replace this 'cheat version'? The below also
doesn't work with nested modules.
module X
class A
def my_module
Object::const_get(self.class.name.split('::')[0])
end
end
end
a = X::A.new
a.my_module => X
Thanks!
martin