I use:
def which(libname)
$:.each { |d|
f = File.join(d, libname)
p f if File.exists? f
f += ".rb"
p f if File.exists? f
}
nil
end
···
-----Original Message-----
From: Harry Ohlsen [mailto:harryo@qiqsolutions.com]
Sent: Wednesday, 24 March 2004 1:33 PM
To: ruby-talk ML
Subject: Ruby’s module search path
Is there an easy way to discover the path to a “require”-ed module
(assuming it’s a .rb file)?
Ie, is there some way to find out where the interpreter would find
fred.rb if I said
require ‘fred’
TIA
Harry O.