net-address 0.2.1 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 218beded001a6aaa1e86bffbaa47ee9c015f69adb9b16deb928f30f984266292
4
- data.tar.gz: 9ca81975952688f85826ce7a41e2ee849912b0681afdf45c94f9269ac765ac94
3
+ metadata.gz: 1c95a8dd7bbfa6b5777238b627d81a21b02c46d49fe16e84fd9d4afabaaaa8c2
4
+ data.tar.gz: 784f1dc4ca3701df008a2ec3e846514ce916266ee67d152d3821dd9e68b00a2c
5
5
  SHA512:
6
- metadata.gz: 5abf59048363abba6a56702286c2da3f4a3f7f036ec30d8601ea6f894015af384e00cffc47c8e8ff9df5cbaa7f9c7cf8f94587474295a61f557b9e4aba59561a
7
- data.tar.gz: 90f01f5d714831bc540a7522ee7af8ea3c11ca260ff82324ff6a06c341444c532d24307970a96a837445102955542b2ec493ad8143cc0df9a6d84c49163329cf
6
+ metadata.gz: ae815546d0db29f6d5fecba1cce8693d04592c1c32c0d523bc604cc7b8aeac2f2f9b7261b9e73d4ea9092d5b8324050bff3f4413e42d0b9af52c1e8aa7a4f339
7
+ data.tar.gz: 8eff963c143340e20711433650faef6da510e6fbb86ac9a28d96b0ec67966dcfc4f5075d5b9bc3301d89dfbf9a82affe10d3916d8004fa9525f9c66a8d6bb59a
@@ -27,6 +27,8 @@ jobs:
27
27
 
28
28
  - name: Set up Ruby
29
29
  uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: 3.0.2
30
32
 
31
33
  - name: Publish to RubyGems
32
34
  run: |
@@ -12,6 +12,8 @@ jobs:
12
12
 
13
13
  - name: Set up Ruby
14
14
  uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 3.0.2
15
17
 
16
18
  - name: Install dependencies
17
19
  run: bundle install
@@ -15,6 +15,13 @@ module Net
15
15
  attr_reader :mask
16
16
 
17
17
  def initialize(address, mask=nil)
18
+ if address.is_a?(String)
19
+ address = begin
20
+ JSON.parse address
21
+ rescue JSON::ParserError
22
+ address
23
+ end
24
+ end
18
25
  parse_address(address)
19
26
  if @mask.nil?
20
27
  @mask = Net::Address::Mask.new(mask.nil? ? 32 : mask)
@@ -88,7 +95,11 @@ module Net
88
95
  private
89
96
 
90
97
  def parse_address(address)
91
- if address.kind_of?(Net::Address::IPv4)
98
+ if address.kind_of?(Hash)
99
+ address = JSON.parse(address.to_json, symbolize_names: true) if address.respond_to?(:to_json)
100
+ parse_string(address[:address])
101
+ @mask = Net::Address::Mask.new address[:mask]
102
+ elsif address.kind_of?(Net::Address::IPv4)
92
103
  @address = address.to_i
93
104
  @mask = address.mask
94
105
  elsif address.kind_of?(IPAddr)
@@ -1,5 +1,5 @@
1
1
  module Net
2
2
  module Address
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-address
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Wojcieszonek
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-13 00:00:00.000000000 Z
11
+ date: 2025-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.2.32
101
+ rubygems_version: 3.2.22
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Ruby library for network addresses