Skip to content

Instantly share code, notes, and snippets.

@enebo
Last active April 24, 2018 19:42
Show Gist options
  • Save enebo/8a83436ec8c35942b61f9edeb69c7341 to your computer and use it in GitHub Desktop.
Save enebo/8a83436ec8c35942b61f9edeb69c7341 to your computer and use it in GitHub Desktop.
class Bignum
def ==(o)
puts "=="
super
end
def eql?(o)
puts "eql?"
super
end
end
10_000_000_000_000_000.eql? 1
1.eql? 10_000_000_000_000_000
class MyNumber < Numeric
def ==(o)
puts "=="
super
end
def eql?(o)
puts "eql?"
super
end
end
m = MyNumber.new
10.eql? m
m.eql? 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment