From: Logan Capaldo Date: 2006-05-18T05:14:51+09:00 Subject: Re: Dynamically modifying modules to avoid namespace collisi On May 17, 2006, at 4:03 PM, Logan Capaldo wrote: > > On May 17, 2006, at 10:11 AM, Gregory Seidman wrote: > >> def find_require_file(filename) >> # NEED IMPLEMENTATION HERE >> end > > def find_require_file(filename) > $LOAD_PATH.each do |directory| > [ ".rb", ".so", ".dll" ].each do |ext| > if File.exists?(f = File.join(directory, filename + ext)) > return f > end > end > end > # otherwise we didn't find it > raise 'Could not find #{filename} in $LOAD_PATH.' > end > > > Actually in retrospect, I should have used double quotes in the raise and if you know you're always gonna be eval-ing these files, you probably want to get rid of the .dll and .so extensions.