You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following examples I would expect the set to only have one entry and the hash to only have one key (note: if it's the same object instance you won't see this behaviour).
require 'set'
require 'ipaddress'
# works as expected
net = IPAddress.parse('192.168.0.0/24')
s = Set.new
s.add net
s.add net
puts s.length # => 1
# doesn't work as expected
s = Set.new
s.add IPAddress.parse('192.168.0.0/24')
s.add IPAddress.parse('192.168.0.0/24')
puts s.length # => 2, should be 1?
# likewise with hashes
# works as expected
net = IPAddress.parse('192.168.0.0/24')
h = {}
h[net] = true
h[net] = false
puts h.length # => 1
# doesn't work as expected
h = {}
h[IPAddress.parse('192.168.0.0/24')] = true
h[IPAddress.parse('192.168.0.0/24')] = false
puts h.length # => 2, should be 1?
The text was updated successfully, but these errors were encountered:
In the following examples I would expect the set to only have one entry and the hash to only have one key (note: if it's the same object instance you won't see this behaviour).
The text was updated successfully, but these errors were encountered: