Skip to content

Instantly share code, notes, and snippets.

@joker1007
Created January 23, 2018 17:28
Show Gist options
  • Save joker1007/bdfc21b154dd2cf7a575851408aa7301 to your computer and use it in GitHub Desktop.
Save joker1007/bdfc21b154dd2cf7a575851408aa7301 to your computer and use it in GitHub Desktop.
unbound method equality
class C1
def meth
end
end
class C2 < C1
def meth
end
end
p C1.instance_method(:meth) == C2.instance_method(:meth).super_method # => true
module M1
def meth
end
end
class C3
include M1
def meth
end
end
p M1.instance_method(:meth) # => #<UnboundMethod: M1#meth>
p C3.instance_method(:meth).super_method # => #<UnboundMethod: M1#meth>
p M1.instance_method(:meth) == C3.instance_method(:meth).super_method # => false (why?)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment