json_data_extractor 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/json_data_extractor.rb +4 -4
- data/lib/src/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 892319b2cab325e75d0e1350c2f6e58e01ecf4ca5cee5ba1228193a51f99e3ca
|
4
|
+
data.tar.gz: 9eba5d4e93b559d8ea59300dcd41f0188dc03ac72c5152e78c3a3d9e4b730781
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05e7e6c2f863b4f1e62d9558b5c670cc8e7eac0398bb150c1f5a71865e25492417d6c9efd8699bfce27ef576fb58a81aa20386cb3af37faee6d599a46466667b
|
7
|
+
data.tar.gz: 66ccf6ba5a410b92c8e4ba1268b27d3c5c4797c61cda7185fc832cf26c6d4bc13f97d157873f6030a5889df5712df94ef365387053cd054131b568e239c90825
|
data/lib/json_data_extractor.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require 'src/version'
|
2
|
+
require 'jsonpath'
|
2
3
|
|
3
4
|
class JsonDataExtractor
|
4
5
|
attr_reader :data, :modifiers
|
@@ -23,14 +24,13 @@ class JsonDataExtractor
|
|
23
24
|
path = val[:path]
|
24
25
|
modifiers = Array(val[:modifiers] || val[:modifier]).map(&:to_sym)
|
25
26
|
array_type = 'array' == val[:type]
|
26
|
-
nested = val.delete(:schema)
|
27
|
+
nested = val.dup.delete(:schema)
|
27
28
|
else
|
28
29
|
path = val
|
29
30
|
modifiers = []
|
30
31
|
end
|
31
32
|
|
32
|
-
|
33
|
-
extracted_data = json_path.on(@data)
|
33
|
+
extracted_data = JsonPath.on(@data, path)
|
34
34
|
|
35
35
|
if extracted_data.empty?
|
36
36
|
results[key] = nil
|
data/lib/src/version.rb
CHANGED