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?
Thanks!
Brian
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?
Thanks!
Brian
On Nov 30, 4:28 pm, Brian H. [email protected] 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?
Create a load monitor, eg.
alias old_require require
def require(path)
puts path, caller, “—”
old_require(path)
end
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.
ruby -r test.rb -e ‘’
./test.rb
ruby -r /home/user/temp/test.rb
/home/user/temp/test.rb
regards,
kaspar
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs