tiny_dot 3.1.4 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tiny_dot.rb +9 -7
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a20e700ab097dedd71d4193b94e15a686c45c49042a79b1f0a1fc64f1582b0d4
4
- data.tar.gz: a4d33f6838c8b93e72b2d3b062e280fad4c5c67e0597b1f83390b4f761d055f1
3
+ metadata.gz: f3ec8b3c35fead6132ebda8b96bae5b856bc106092c5a474ba326551177d3372
4
+ data.tar.gz: 527e7a75b8761a4273db4ebc84516797727b144adef06afc8fe105e2b88713da
5
5
  SHA512:
6
- metadata.gz: 88b723323b1316f46077692b1e5838210713fd93b99f025d473ab2527c8d24dc97715173758c439c48751f049331a0b82f6e1510c2cc96b20fad81a288fc21a0
7
- data.tar.gz: 42ee08b11cd9a29bf8ba5f41ea597bc1c36a19f887d943337ee2e4dda835feb8c31457c8232ceaf37d5b1222c145c1e72dd1e393b404a23b17e4a337d40b0e1e
6
+ metadata.gz: bc9ee68882c48f76fa70601f2ccb57c3468de75ec3793a07660390e9ea8b5c60066e731155353a34ce6256b11d833b9a01024962609a4f054a4d7313034552cb
7
+ data.tar.gz: f7c25df59caa78c9df9f2a471580e884b77690db316dc579e3ed37798bbdf1f45e2f4b48a44c246f6aea88f82e1348713060cf40cf0c2ecae4b49bd51920be19
data/lib/tiny_dot.rb CHANGED
@@ -66,21 +66,23 @@ module TinyDot
66
66
  _hash_to_struct(hash)
67
67
  end
68
68
 
69
- def _hash_to_struct(hash)
70
- case hash
69
+ def _hash_to_struct(obj)
70
+ case obj
71
71
  when Hash
72
- struct = ::Struct.new(*_to_attr_friendly_symbols(hash.keys))
73
- struct.new(*hash.values.map { |v| _hash_to_struct(v) })
72
+ return obj if obj.keys.empty?
73
+
74
+ struct = ::Struct.new(*_to_attr_friendly_symbols(obj.keys))
75
+ struct.new(*obj.values.map { |v| _hash_to_struct(v) })
74
76
  when Array
75
- hash.map { |v| _hash_to_struct(v) }
77
+ obj.map { |v| _hash_to_struct(v) }
76
78
  else
77
- hash
79
+ obj
78
80
  end
79
81
  end
80
82
 
81
83
  def _to_attr_friendly_symbols(keys)
82
84
  keys
83
- .map{|k| k.gsub(/[-\s]/, '_') }
85
+ .map{|k| k.to_s.gsub(/[-\s]/, '_') }
84
86
  .map(&:to_sym)
85
87
  end
86
88
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_dot
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Lunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-14 00:00:00.000000000 Z
11
+ date: 2023-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  requirements: []
54
- rubygems_version: 3.3.7
54
+ rubygems_version: 3.4.1
55
55
  signing_key:
56
56
  specification_version: 4
57
57
  summary: this library will take in one of the supported formats and will recursively