From: David Garamond Date: 2004-03-24T15:02:16+09:00 Subject: Re: Ruby's module search path Simon Strandgaard wrote: >>Is there an easy way to discover the path to a "require"-ed module (assuming it's a .rb file)? > > You may want to look at rextra.. I found this > > def required > result = [] > $".each do |file| > $:.each do |path| > if File.exists?( path + '/' + file ) > result << (path + '/' + file) > next > end > end > end > result > end Btw, this is not really reliable (i.e. always correct) right? Since $: might have been manipulated in between. Also the code above did not check the case when a file is required by absolute path. To be more reliable, perhaps extend Kernel::require. Or always require with absolute path (but that's un-Rubic). -- dave