Created
January 23, 2018 17:28
-
-
Save joker1007/bdfc21b154dd2cf7a575851408aa7301 to your computer and use it in GitHub Desktop.
unbound method equality
This file contains 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
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