From: jc Date: 2005-02-19T00:14:51+09:00 Subject: Re: How to get the module that a class resides in? What I'm really looking for is a more generic method, something like Object#parent_namespace: class A; end module B class C D = A.new end end puts A.parent_namespace => Object puts B.parent_namespace => Object puts B::C.parent_namespace => B puts B::C::D.parent_namespace => C puts B::C::D.class.parent_namespace => Object So that lookups could be easily done: obj.parent_namespace.const_get(:name) obj.parent_namespace.send(name, value) Is there perhaps a way to do this via the Ruby C API?