N
Nick Brown
The .eql? method is supposed to return true if the objects are == and of
the same class, correct? This is *not* the case with IPAddr objects.
irb(main):001:0> require 'ipaddr'
=> true
irb(main):002:0> a = IPAddr.new('1.1.1.1')
=> #<IPAddr: IPv4:1.1.1.1/255.255.255.255>
irb(main):003:0> b = IPAddr.new('1.1.1.1')
=> #<IPAddr: IPv4:1.1.1.1/255.255.255.255>
irb(main):004:0> a == b
=> true
irb(main):005:0> a.eql? b
=> false
irb(main):006:0> a == b and a.class == b.class
=> true
Clearly, the value of "a.eql? b" should be true, not false.
This bug breaks several things. In my case, it causes Sets of IPAddr
objects to contain duplicates, angering the gods of mathematics.
the same class, correct? This is *not* the case with IPAddr objects.
irb(main):001:0> require 'ipaddr'
=> true
irb(main):002:0> a = IPAddr.new('1.1.1.1')
=> #<IPAddr: IPv4:1.1.1.1/255.255.255.255>
irb(main):003:0> b = IPAddr.new('1.1.1.1')
=> #<IPAddr: IPv4:1.1.1.1/255.255.255.255>
irb(main):004:0> a == b
=> true
irb(main):005:0> a.eql? b
=> false
irb(main):006:0> a == b and a.class == b.class
=> true
Clearly, the value of "a.eql? b" should be true, not false.
This bug breaks several things. In my case, it causes Sets of IPAddr
objects to contain duplicates, angering the gods of mathematics.