kafo_parsers 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f510d851fccf71e96f9fd835195990a4e669fd5722592f1673823a4a651eeb77
4
- data.tar.gz: e98e7f725fd65d900371fef825db343b25fedd70ac9aee21edaeeaef25ca7d98
3
+ metadata.gz: 747520cf42c2a91caca542f85d2185620e75e291fb5cbaaa6e51bf7850868704
4
+ data.tar.gz: 556665c63d578dcc13e346a80413da96735be1fcf9df0294258e536ceff546e7
5
5
  SHA512:
6
- metadata.gz: cdbe4e4c5ebab2e4e41f29209c4b84f8c595e7585f0deb1d8f94ae2c90519810874b76458a96acf98255de9721c3502cbbd97390829180caa125bcda0673778b
7
- data.tar.gz: da851240e0bde3e0fe253b9c3e9e6953fb83e21eea8c15740f28df6065192b0d446c4dcc7825d0d8204ebcdfb4368c69238e0d978a3cf598d10115e21fd5485e
6
+ metadata.gz: 92bb6e4a7c67b7a28c8834bfa702b56a87a538aa0e0055a7348369e3ef1d934a35fa6331c0758623aade6d427edc7a40a699b0c15ae282086b078e58f7479b11
7
+ data.tar.gz: 41ebd83a1ce35095dbd5206d6bfc27bd9d45499c77e32a96846330fda95f949a92343a3e802d13e60c17b3f8464e34a062e2139b278e293fd72a6d18d8dc32d9
@@ -173,10 +173,21 @@ module KafoParsers
173
173
  #
174
174
  # values are reported as strings which is issue especially for :under
175
175
  # strings are double quoted
176
+ # basic array and hashes are supported
176
177
  # others must be typecast manually according to reported type
177
178
  def sanitize(value)
178
179
  if (value.start_with?("'") && value.end_with?("'")) || (value.start_with?('"') && value.end_with?('"'))
179
180
  value = value[1..-2]
181
+ elsif value.start_with?('[') && value.end_with?(']')
182
+ # TODO: handle commas in strings like ["a,b", "c"]
183
+ value = value[1..-2].split(',').map { |v| sanitize(v.strip) }
184
+ elsif value.start_with?('{') && value.end_with?('}')
185
+ # TODO: handle commas and => in strings, like {"key" => "value,=>"}
186
+ value = value[1..-2].split(',').map do |v|
187
+ split = v.strip.split('=>')
188
+ raise 'Invalid hash' unless split.length == 2
189
+ split.map { |s| sanitize(s.strip) }
190
+ end.to_h
180
191
  end
181
192
  value = :undef if value == 'undef'
182
193
 
@@ -1,3 +1,3 @@
1
1
  module KafoParsers
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafo_parsers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '3'
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.5'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rake
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -145,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
151
  - !ruby/object:Gem::Version
146
152
  version: '0'
147
153
  requirements: []
148
- rubygems_version: 3.1.4
154
+ rubygems_version: 3.1.6
149
155
  signing_key:
150
156
  specification_version: 4
151
157
  summary: Puppet module parsers