Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# 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