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:

https://github.com/homebrew/brew/blob/8518ffdee19c0c985e8631e836b78624e4926c7f/library/homebrew/brew.rb

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

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -