Last active
February 22, 2016 21:43
-
-
Save marianposaceanu/1dd65a908f00db22cb9f to your computer and use it in GitHub Desktop.
This file contains 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
# The classics | |
class Foo | |
def bar; end | |
def self.baz; end | |
end | |
Foo.instance_method(:bar).source_location | |
Foo.method(:baz).source_location | |
# A tad more | |
constant = User | |
$".detect{|load_path| | |
load_path.include?(constant.to_s.underscore) | |
} | |
# Credits | |
# http://stackoverflow.com/questions/9868649/how-do-i-find-where-a-constant-is-defined-in-ruby |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment