From: paul.p.carey@... Date: 2006-02-16T18:08:27+09:00 Subject: Creating objects without knowing their names Hi I'd like to load an arbitary number of Ruby files from a directory and create their associated objects. However, I don't know the class names of the files that have just been loaded. Is it possible to determine a file's class name once that file has been loaded? (Without resorting to parsing, or enforcing a mapping between the filename and class name.) What I want to do is something like the following: converter_names = Array.new Find.find("./converters") do |filename| converter_names.push(filename) if filename =~ /rb$/ end converters = Array.new converter_names.each do |converter_name| load converter_name klassName = ...? converters.push(Object.const_get(klassName).new) end Many thanks Paul