I'm having a problem in which a file is being required twice, using
slightly different paths, and I want to track down where this is
happening. Is there a way I can print out the path used to require a
given file?
alias old_require require
def require(path)
puts path, caller, "---"
old_require(path)
end
···
On Nov 30, 4:28 pm, Brian Hartin <brian.har...@pearson.com> wrote:
Hi all,
I'm having a problem in which a file is being required twice, using
slightly different paths, and I want to track down where this is
happening. Is there a way I can print out the path used to require a
given file?
I'm having a problem in which a file is being required twice, using
slightly different paths, and I want to track down where this is
happening. Is there a way I can print out the path used to require a
given file?
In most Ruby implementations the __FILE__ constant will be different depending on how the file was loaded. Notably, it will reflect the path used to load the file.