From: Emmanuel Oga Date: 2007-11-05T12:22:24+09:00 Subject: Re: Reading a class-file and calling it at runtime. mmm i believe i messed up the things a bit, this should be the right thing to do, if complex, anyway: plugin_classes= [] Dir[File.join(File.dirname(__FILE__), '/plugins/*.rb')].each do |file| file_name= File.basename(file) require_relative __FILE__, 'plugins', file_name plugin_classes << $1.camelize.constantize if file_name =~ /(.*)\.rb$/i end There, now it should work! :) > > plugin_classes= [] > > Dir[File.join(File.dirname(__FILE__), '/plugins/*.rb')].each do |file| > require_relative __FILE__, file > name= File.basename(file) > plugin_classes << $1.camelize.constantize if name =~ /(.*)\.rb$/i > end > > There... it sounds easy, no? :) -- Posted via http://www.ruby-forum.com/.