From: Robert Klemme Date: 2005-11-23T00:37:24+09:00 Subject: Re: There must be a better way -- requiring multiple files David Teare wrote: > Hi all, > > I want to require all ruby files from a "lib" directory. This is > what I did so far: > > lib_path = File.expand_path(__FILE__ + "/../../lib/") > Dir.new(lib_path).entries.each { |f| require lib_path + '/' + f > if f =~ /.*\.rb/ } > > Is there an easier way? Dir[File.join(__FILE__, "..", "..", "lib", "*.rb")].each {|l| require l} recursive: Dir[File.join(__FILE__, "..", "..", "lib", "**", "*.rb")].each {|l| require l} Kind regards robert