From: Robert Klemme Date: 2006-08-09T01:25:05+09:00 Subject: Re: load paths unions? On 08.08.2006 18:06, Trans wrote: > I want to be able to "union" some load paths. Eg. given > > lib/facets/more > lib/facets/core > > I'd like to be able to do > > require 'facets/foo.rb' > > And have it search both more/ and core/ for foo.rb. Usually you do require 'facets/foo' and have a file "xyz.rb" in facets that will link "more/foo.rb" or "core/foo.rb" depending on where it's located. You could as well do this: create a file "facets.rb" in the same directory that holds "facets" (i.e. lib). Inside of that you do def frequire(*names) names.each do |name| %w{more core}.any? do |base| begin require "facets/#{base}/#{name}" true rescue false end end or raise LoadError, "Did not find #{name}" end end Or something similar. robert