> I have to say that this concept strikes me as being really very > risky. However... > def forName(className) > ObjectSpace.each_object(Class) do |c| > return c if c.name == className > end > raise "Class #{className} not found" > end The following looks for a full pathname from the Object class. It is when you wish to look for a class in particular, and not for all the classes of the same name. It is when you wish only to access classes you are supposed to have access to by name in the first place. It is also when you want your search to take less time than a full GC phase. def const_get_rec(foo) bar = foo.split /::/ bar.reverse! unf = Object unf = unf.const_get(bar.pop) while bar.length > 0 unf end p const_get_rec("IO::File::NONBLOCK") p IO::File::NONBLOCK Another version (requires inject): def const_get_rec(foo) foo.split(/::/).inject(Object) {|x,y| x.const_get(y) } end matju