Skip to content

Instantly share code, notes, and snippets.

@jeygeethan
Created August 12, 2018 12:54
Show Gist options
  • Save jeygeethan/f9e1964e54ce00ca9fe17444b1b1fa6d to your computer and use it in GitHub Desktop.
Save jeygeethan/f9e1964e54ce00ca9fe17444b1b1fa6d to your computer and use it in GitHub Desktop.
Find out where a ruby method is defined
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