From: Matthias Veit Date: 2002-10-14T23:08:03+09:00 Subject: access surrounding class Hello, is there a possibility in ruby to access the surrounding runtime type from within a nested class? Module.nesting is not sufficient, because it relies on definition time: Following scenario: ------------------snip----------------------- class A class C def a puts ..::type #access surrounding class end end end class B < A end ------------------snap----------------------- A::C.new.a should print "A", B::C.new.a should print "B". How to do that? I thought about constants: class A CONST=A end class B < A CONST=B end or even methods, that get refined in specialising classes, but all solutions have the same problem: The access of the runtime type of the surrounding class. Is there any suggestion or idea, to solve this problem?? Best regards, Matthias __________________________________________________ Do You Yahoo!? Sign up for SBC Yahoo! Dial - First Month Free http://sbc.yahoo.com