ruby - How can I tell which file is being required here? -
this question has answer here:
i'm reading through codebase of homebrew repo, file here:
i see many 'require' statements scattered throughout file, instance on line 104 (require 'tap'). problem see 3 files named tap.rb in codebase:
library/homebrew/tap.rb library/homebrew/cmd/tap.rb library/homebrew/compat/tap.rb
further down in code see tap.fetch..., , in library/homebrew/tap.rb contains class named tap class method named fetch, i'm confident correct file that's being included. conceivably, there dozens of files same filename, , more 1 of have identical class methods. question is, there way tell tap class being loaded without looking through each of files?
update: think have answer question (see below).
if put binding.pry before require , execute $: list of directories in require 'tap.rb' files.
see definition of require: if filename not resolve absolute path, searched in directories listed in $:.
Comments
Post a Comment