Created
August 15, 2020 14:42
-
-
Save gerrywastaken/f64e32d9cc57c4e7f9631b613f9c1ac8 to your computer and use it in GitHub Desktop.
Find the path that Ruby's require statement tries to load. This is actually inaccurate as it misses steps like checking an absolute path, but it worked for my use case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def debug_require(path) | |
$LOAD_PATH.each do |lp| | |
full_path = "#{lp}/#{path}" | |
puts full_path if File.file?(full_path) | |
full_rb_path = "#{full_path}.rb" | |
puts full_rb_path if File.file?(full_rb_path) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment