Edward Ocampo-Gooding
Edward Ocampo-Gooding

Reputation: 2862

How can I see where a module or class was `require`-d in?

I’m having trouble hunting down where in a project a particular library is being require-ed in.

Is there a method or technique that can tell me the filename and line?

Upvotes: 0

Views: 39

Answers (2)

Casper Beyer
Casper Beyer

Reputation: 2301

Just off the top of my head, you could monkey patch require and print out __FILE__ and __LINE__

Upvotes: 0

Vasiliy Ermolovich
Vasiliy Ermolovich

Reputation: 24617

You didn't mention a system you are using but you can use grep or ack-grep for this task:

ack-grep "require 'simple_form'"

Upvotes: 1

Related Questions