Created
August 12, 2018 12:54
-
-
Save jeygeethan/f9e1964e54ce00ca9fe17444b1b1fa6d to your computer and use it in GitHub Desktop.
Find out where a ruby method is defined
This file contains hidden or 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
module Foo | |
def say_hello | |
puts "hello" | |
end | |
end | |
class Bar | |
include Foo | |
end | |
puts Bar.new.method(:say_hello) #=> #<Method: Bar(Foo)#say_hello> | |
puts Bar.new.method(:say_hello).source_location #=> hello.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment