Skip to content

Instantly share code, notes, and snippets.

@phiggins
Created September 30, 2013 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phiggins/6771033 to your computer and use it in GitHub Desktop.
Save phiggins/6771033 to your computer and use it in GitHub Desktop.
module Kernel
def method_a
:foo
end
end
def method_b
:bar
end
p a: method_a, b: method_b
puts
p a: method(:method_a).owner, b: method(:method_b).owner
puts
p a: method(:method_a).owner.ancestors, b: method(:method_b).owner.ancestors
pete@balloon:~/projects$ ruby -v defs.rb
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
{:a=>:foo, :b=>:bar}
{:a=>Kernel, :b=>Object}
{:a=>[Kernel], :b=>[Object, Kernel, BasicObject]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment