IPAddr#== implements wrong logic
IPAddr#== should implement the logic of comparison of two IPAddr instances. This generally means that it compares two IP addresses.
Lets look at the code of this method:
return @family == other.family && @addr == other.to_i
It returns the result of comparison of the families and the addresses, but it should also compare the netmask which describes the network where this address is located.
The code below shows the test case for this comparison:
ip1 = IPAddr.new '126.96.36.199/24'
ip2 = IPAddr.new '188.8.131.52/26'
ip1 == ip2 #=> true
This code shows that two identical IP addresses from different networks are equal. But the result should be
false because these addresses are not identical.
Depending on Feature #11210 i would propose following implementation of this method:
other = coerce_other(other)
return @family == other.family && @addr == other.to_i && @mask_addr == other.netmask