From: "Iñaki Baz Castillo" Date: 2009-04-04T06:24:07+09:00 Subject: Re: Loading classes in order El Viernes 03 Abril 2009, Elias Orozco escribió: > Hello guys, > > I have a folder that contains several classes. There are some some > dependencies between them as one class could extend from another one > included in the folder. I am trying to require them all dynamically but > I get: > > uninitialized constant > > This happens because I try to require a class that extends from a class > I haven't require yet. So can anyone help or give me any hint on how to > load them all dynamically and deal with those dependencies? path = File.dirname(__FILE__) + "/files_dir" require "#{path}/required_file1" require "#{path}/required_file2" require "#{path}/required_file3" Dir.chdir(path) Dir["*.rb"].each do |file| require "#{path}/#{file}" end -- Iñaki Baz Castillo