ipaddress_2 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/ipaddress_2.gemspec +1 -1
- data/lib/ipaddress_2/ipv4.rb +11 -2
- data/lib/ipaddress_2/ipv6.rb +10 -1
- data/lib/ipaddress_2/version.rb +1 -1
- data/test/ipaddress_2/ipv4_test.rb +6 -1
- data/test/ipaddress_2/ipv6_test.rb +5 -0
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 359df425a73931023ee0026c8fdb2819f43117e24e1aa24b5ff7bb3d7f6121f6
|
4
|
+
data.tar.gz: db06b07d89444432225af2e82529a0eca395cda6e42ed59bf0cf443befc914c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b537db60dfaf772c2162d3c1f52c0066b0737af5811fa0ac1894aa86414ce86950f4bba00c8aa3c3a1c1171937de26848933020ce428f5b7df04611a08bcf19f
|
7
|
+
data.tar.gz: e2632e98d23618da97172f711d1736d7b6845105cb53412c42db5caa6326edc66b9e1f1ec2319f61855d1c54f3fa743df02cd653a6fd86f933b4f5d9944392f3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.14.0
|
data/ipaddress_2.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.version = IPAddress::VERSION
|
10
10
|
s.require_paths = ["lib"]
|
11
11
|
s.authors = ["bluemonk", "mikemackintosh"]
|
12
|
-
s.description = "IPAddress2 is a Ruby library designed to make manipulation\n of IPv4 and IPv6 addresses both powerful and simple. It
|
12
|
+
s.description = "IPAddress2 is a Ruby library designed to make manipulation\n of IPv4 and IPv6 addresses both powerful and simple. It maintains\n a layer of compatibility with Ruby's own IPAddr, while\n addressing many of its issues."
|
13
13
|
s.email = "adam@21eleven.com"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"CHANGELOG.rdoc",
|
data/lib/ipaddress_2/ipv4.rb
CHANGED
@@ -640,7 +640,7 @@ module IPAddress;
|
|
640
640
|
#
|
641
641
|
# Checks whether a subnet includes the given IP address.
|
642
642
|
#
|
643
|
-
# Accepts an IPAddress::IPv4 object.
|
643
|
+
# Accepts an IPAddress::IPv4 object or a string.
|
644
644
|
#
|
645
645
|
# ip = IPAddress("192.168.10.100/24")
|
646
646
|
#
|
@@ -652,13 +652,19 @@ module IPAddress;
|
|
652
652
|
# ip.include? IPAddress("172.16.0.48/16")
|
653
653
|
# #=> false
|
654
654
|
#
|
655
|
+
# ip.include? "192.168.10.50"
|
656
|
+
# #=> true
|
657
|
+
#
|
655
658
|
def include?(oth)
|
659
|
+
unless oth.is_a? IPAddress::IPv4
|
660
|
+
oth = IPv4.new(oth)
|
661
|
+
end
|
656
662
|
@prefix <= oth.prefix and network_u32 == (oth.to_u32 & @prefix.to_u32)
|
657
663
|
end
|
658
664
|
|
659
665
|
#
|
660
666
|
# Checks whether a subnet includes all the
|
661
|
-
# given IPv4 objects.
|
667
|
+
# given IPv4 objects or strings.
|
662
668
|
#
|
663
669
|
# ip = IPAddress("192.168.10.100/24")
|
664
670
|
#
|
@@ -668,6 +674,9 @@ module IPAddress;
|
|
668
674
|
# ip.include_all?(addr1,addr2)
|
669
675
|
# #=> true
|
670
676
|
#
|
677
|
+
# ip.include_all?("192.168.10.102/24", "192.168.10.103/24")
|
678
|
+
# #=> true
|
679
|
+
#
|
671
680
|
def include_all?(*others)
|
672
681
|
others.all? {|oth| include?(oth)}
|
673
682
|
end
|
data/lib/ipaddress_2/ipv6.rb
CHANGED
@@ -612,13 +612,19 @@ module IPAddress;
|
|
612
612
|
# ip6.include? IPAddress("2001:db8:1::8:800:200c:417a/76")
|
613
613
|
# #=> false
|
614
614
|
#
|
615
|
+
# ip6.include? "2001:db8::8:800:200c:1"
|
616
|
+
# #=> true
|
617
|
+
#
|
615
618
|
def include?(oth)
|
619
|
+
unless oth.is_a? IPAddress::IPv6
|
620
|
+
oth = IPv6.new(oth)
|
621
|
+
end
|
616
622
|
@prefix <= oth.prefix and network_u128 == self.class.new(oth.address+"/#@prefix").network_u128
|
617
623
|
end
|
618
624
|
|
619
625
|
#
|
620
626
|
# Checks whether a subnet includes all the
|
621
|
-
# given IPv4 objects.
|
627
|
+
# given IPv4 objects or strings.
|
622
628
|
#
|
623
629
|
# ip = IPAddress("2001:db8:8:800::1/64")
|
624
630
|
#
|
@@ -628,6 +634,9 @@ module IPAddress;
|
|
628
634
|
# ip.include_all?(addr1,addr2)
|
629
635
|
# #=> true
|
630
636
|
#
|
637
|
+
# ip.include_all?("2001:db8:8:800::2/64", "2001:db8:8:800::8/64")
|
638
|
+
# #=> true
|
639
|
+
#
|
631
640
|
def include_all?(*others)
|
632
641
|
others.all? {|oth| include?(oth)}
|
633
642
|
end
|
data/lib/ipaddress_2/version.rb
CHANGED
@@ -327,7 +327,10 @@ class IPv4Test < Minitest::Test
|
|
327
327
|
assert_equal false, ip.include?(@klass.new("5.5.5.5/32"))
|
328
328
|
assert_equal false, ip.include?(@klass.new("11.0.0.0/8"))
|
329
329
|
ip = @klass.new("13.13.0.0/13")
|
330
|
-
assert_equal false, ip.include?(@klass.new("13.16.0.0/32"))
|
330
|
+
assert_equal false, ip.include?(@klass.new("13.16.0.0/32"))
|
331
|
+
ip = @klass.new("10.10.10.0/24")
|
332
|
+
assert_equal true, ip.include?("10.10.10.100")
|
333
|
+
assert_equal false, ip.include?("10.10.9.100")
|
331
334
|
end
|
332
335
|
|
333
336
|
def test_method_include_all?
|
@@ -336,6 +339,8 @@ class IPv4Test < Minitest::Test
|
|
336
339
|
addr2 = @klass.new("192.168.10.103/24")
|
337
340
|
assert_equal true, ip.include_all?(addr1,addr2)
|
338
341
|
assert_equal false, ip.include_all?(addr1, @klass.new("13.16.0.0/32"))
|
342
|
+
assert_equal true, ip.include_all?("192.168.10.102/24", "192.168.10.103/24")
|
343
|
+
assert_equal false, ip.include_all?(addr1, "13.16.0.0/32")
|
339
344
|
end
|
340
345
|
|
341
346
|
def test_method_ipv4?
|
@@ -352,6 +352,9 @@ class IPv6Test < Minitest::Test
|
|
352
352
|
not_included = @klass.new "2001:db8:1::8:800:200c:417a/76"
|
353
353
|
assert_equal true, @ip.include?(included)
|
354
354
|
assert_equal false, @ip.include?(not_included)
|
355
|
+
# string test
|
356
|
+
assert_equal true, @ip.include?("2001:db8::8:800:200c:2")
|
357
|
+
assert_equal false, @ip.include?("2001:db8:1::8:800:200c:417a")
|
355
358
|
end
|
356
359
|
|
357
360
|
def test_method_include_all?
|
@@ -360,6 +363,8 @@ class IPv6Test < Minitest::Test
|
|
360
363
|
addr2 = @klass.new("2001:db8:8:800::8/64")
|
361
364
|
assert_equal true, ip.include_all?(addr1,addr2)
|
362
365
|
assert_equal false, ip.include_all?(addr1, @klass.new("2002:db8:8:800::2/64"))
|
366
|
+
assert_equal true, ip.include_all?("2001:db8:8:800::2/64", "2001:db8:8:800::8/64")
|
367
|
+
assert_equal false, ip.include_all?(addr1, "2002:db8:8:800::2/64")
|
363
368
|
end
|
364
369
|
|
365
370
|
def test_method_to_hex
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipaddress_2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bluemonk
|
8
8
|
- mikemackintosh
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-07-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
description: |-
|
133
133
|
IPAddress2 is a Ruby library designed to make manipulation
|
134
|
-
of IPv4 and IPv6 addresses both powerful and simple. It
|
134
|
+
of IPv4 and IPv6 addresses both powerful and simple. It maintains
|
135
135
|
a layer of compatibility with Ruby's own IPAddr, while
|
136
136
|
addressing many of its issues.
|
137
137
|
email: adam@21eleven.com
|
@@ -172,7 +172,7 @@ homepage: https://github.com/ipaddress2-gem/ipaddress_2
|
|
172
172
|
licenses:
|
173
173
|
- MIT
|
174
174
|
metadata: {}
|
175
|
-
post_install_message:
|
175
|
+
post_install_message:
|
176
176
|
rdoc_options: []
|
177
177
|
require_paths:
|
178
178
|
- lib
|
@@ -187,9 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
|
-
|
191
|
-
|
192
|
-
signing_key:
|
190
|
+
rubygems_version: 3.2.3
|
191
|
+
signing_key:
|
193
192
|
specification_version: 4
|
194
193
|
summary: IPv4/IPv6 address manipulation library
|
195
194
|
test_files: []
|