lib/ipaddress_2/ipv6.rb in ipaddress_2-0.13.0 vs lib/ipaddress_2/ipv6.rb in ipaddress_2-0.14.0

- old
+ new

@@ -610,23 +610,32 @@ # #=> true # # ip6.include? IPAddress("2001:db8:1::8:800:200c:417a/76") # #=> false # + # ip6.include? "2001:db8::8:800:200c:1" + # #=> true + # def include?(oth) + unless oth.is_a? IPAddress::IPv6 + oth = IPv6.new(oth) + end @prefix <= oth.prefix and network_u128 == self.class.new(oth.address+"/#@prefix").network_u128 end # # Checks whether a subnet includes all the - # given IPv4 objects. + # given IPv4 objects or strings. # # ip = IPAddress("2001:db8:8:800::1/64") # # addr1 = IPAddress("2001:db8:8:800::2/64") # addr2 = IPAddress("2001:db8:8:800::8/64") # # ip.include_all?(addr1,addr2) + # #=> true + # + # ip.include_all?("2001:db8:8:800::2/64", "2001:db8:8:800::8/64") # #=> true # def include_all?(*others) others.all? {|oth| include?(oth)} end