Skip to content

Instantly share code, notes, and snippets.

@gerrywastaken
Created August 15, 2020 14:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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.
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