network-utility 1.1.43 → 1.1.44

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/network.rb +1 -1
  3. data/utility/ipv4_address.rb +18 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efefda6c8d40e86b6cbf5721bce9069fc335e2593e7bc53245538738fac87643
4
- data.tar.gz: f5e98f9ada324bdcb1df2bb108bb5bb2cd59408d7b5ab4cd31631c1eefc27a8b
3
+ metadata.gz: c4ccc5a9ed9d02063837b9114fb98342726aaff01b5f8a3b76c1012eaade0991
4
+ data.tar.gz: b9e331486a5e504937dcf3253969ee62b12d6cab6f1693d964213b81cfa254de
5
5
  SHA512:
6
- metadata.gz: 5b590eb785a6bbf02cf5b7b7011f2f80e23210ff855e52ad241f2ef4a955c23a3a8eaf38998f58042a34ecd153a95cc1488a9741efc665b0dddaa9c418fe86d4
7
- data.tar.gz: 298bf7e8f4da077a4fbb3643cbb0dafd802173d435457c3f462058cc62c87956d5f074cc370d4d194ed25baa742850fccf17ae62e939bdb00cf190f39a87c45a
6
+ metadata.gz: 32b3c3678b9a31c2abb2361f5d0beb9f5060f80fbf70c785e75ff1e86812c187c4a45f886f244c30327c0a175d8eeecb2b7f3d76ac8a8b3dc76b6945a7574285
7
+ data.tar.gz: b449e0463c5c037cd1811a1e08f61c8302d1612870d8f53d9c14265923f6b738842a7992068c53be1c7eb28a021a06d6d924c0b8da28f7dc0e327786619b01b4
data/network.rb CHANGED
@@ -22,5 +22,5 @@
22
22
  ].each{|mod|require mod}
23
23
 
24
24
  module Network
25
- VERSION = '1.1.43'
25
+ VERSION = '1.1.44'
26
26
  end
@@ -281,7 +281,9 @@ class IPv4Mask
281
281
  end
282
282
 
283
283
  module IP
284
- def self.v4 string
284
+ module_function
285
+
286
+ def v4 string
285
287
  ip,msk = string.split("/")
286
288
  unless msk
287
289
  return IPv4.new(ip)
@@ -290,4 +292,19 @@ module IP
290
292
  return IPv4.new(ip),mask
291
293
  end
292
294
  end
295
+
296
+ def range addr
297
+ if addr.include?('.')
298
+ gateway, netmask = IP.v4(addr)
299
+ elsif addr.include?(':')
300
+ gateway, netmask = IP.v6(addr)
301
+ end
302
+ if netmask
303
+ network = gateway.network_with(netmask)
304
+ start, finish = network.range_with(netmask)
305
+ return [start, finish]
306
+ else
307
+ return [gateway, gateway]
308
+ end
309
+ end
293
310
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: network-utility
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.43
4
+ version: 1.1.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt