better_ipaddr 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/better_ipaddr/classes.rb +9 -2
- data/lib/better_ipaddr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44911d183145a57efbc10650b9f7da538ca39613
|
4
|
+
data.tar.gz: 3291ad4bf6a24bbcd557d57b33af26ea4d8695c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 851ccffe6d759df96863562ff26e12cb3446450d9b57e0a6887a9eeabf0b80df9ffe53585fd1486f1f2043016cce4c8e7172361432e2011a1f4641696f64ba0d
|
7
|
+
data.tar.gz: 82966ccbd03491190b9bcbf73c2bd73f9ba4d52aa0c8fa739e2a9d2287f6c5cfd9e7cf74041832146d95fa9f8950de18980d196d58686c473db7c67f4bfb2a3a
|
@@ -12,8 +12,15 @@ class IPAddr
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.[](address, mask = nil, family: self::FAMILY)
|
15
|
-
|
16
|
-
|
15
|
+
case mask
|
16
|
+
when Integer
|
17
|
+
if 0 <= mask && mask <= FAMILY_TO_BIT_LENGTH[family]
|
18
|
+
new(address, family).mask(mask)
|
19
|
+
else
|
20
|
+
new(address, family).mask(new(mask, family).to_s)
|
21
|
+
end
|
22
|
+
when String, IPAddr
|
23
|
+
new(address, family).mask(mask.to_s)
|
17
24
|
else
|
18
25
|
new(address, family)
|
19
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_ipaddr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Miller
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.5.1
|
98
|
+
rubygems_version: 2.4.5.1
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: IPAddr enhancements for network management.
|