On Monday, November 29, 2004, 10:15:36 PM, David wrote: >> > Oh right, I forgot about that. There are some "deep" const_get >> > implementations floating around... along the lines of: >> >> > def deep_const_get(str) >> > str.split('::').inject(Object) {|a,b| a.const_get(b) } >> > end >> >> > which might help. >> >> That's precisely how it's implemented in extensions. BTW it's now >> Class.by_name. >> >> Class.by_name("::Test::Unit") -> Test::Unit > Is this restricted to Class objects? No. It's defined in Module as class Module def Module.by_name(name) name = name.to_str.sub(/^::([A-z])/, '\1') name.split(/::/).inject(Object) { |mod, name| mod.const_get(name) } end end So trailing constants in a path are accepted, like Shapes::Circle::MAX_RADIUS Hadn't thought of that... Gavin