From: Alexandre Mutel Date: 2009-12-01T07:47:31+09:00 Subject: Re: Problem trying to get a constant with correct scope Currently, i'm using something like class Module def dyn_const_get(sym) list = name.split('::').inject([Object]) {|hierarchy,name| hierarchy << hierarchy.last.const_get(name)} result = nil while !list.empty? && result.nil? begin lookup_in = list.pop result = lookup_in.const_get sym rescue end end result end end And performing : A::C.dyn_const_get(:B) returns A::B But that's a very bad option in terms of performance... I'm wondering if there are any other options? -- Posted via http://www.ruby-forum.com/.