json_paths 0.0.3 → 0.0.4
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 +4 -4
- data/lib/json_paths/version.rb +1 -1
- data/lib/json_paths.rb +3 -3
- data/spec/json_paths_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 378041b2d0f3e8addc5323c3d53edc170c5c5fa9
|
4
|
+
data.tar.gz: 334f213651826ff3e7bbf55ac7c08f622e3e6fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b161ab7b5e9306d63fea45abba61e88257f9d9bd04ec83e1b8bd4c677b1e121dab3014388984b0221de815dafd690bfd43bfb4798ea0d55beae9cd981bf5a8a1
|
7
|
+
data.tar.gz: 115a265f4a05092852c555a1ae347a53688bf145b17c31159690375c4324664bf3fe6b9504dc7c81b38623007cdf55ced53d2a6cc8d0a14800672da66129bb8a
|
data/lib/json_paths/version.rb
CHANGED
data/lib/json_paths.rb
CHANGED
@@ -33,9 +33,9 @@ class JsonPaths
|
|
33
33
|
value = hash[key]
|
34
34
|
|
35
35
|
if value.respond_to?(:keys)
|
36
|
-
|
37
|
-
key_to_path(value, k).map { |ktp| key + "." + ktp }
|
38
|
-
end
|
36
|
+
value.each_key do |k|
|
37
|
+
paths_for_key << key_to_path(value, k).map { |ktp| key + "." + ktp }
|
38
|
+
end
|
39
39
|
elsif value.respond_to?(:each_with_index)
|
40
40
|
value.each_with_index do |v,i|
|
41
41
|
paths_for_key << JsonPaths.new(v.to_json).paths.map do |j|
|
data/spec/json_paths_spec.rb
CHANGED
@@ -10,7 +10,10 @@ describe JsonPaths do
|
|
10
10
|
"c": 2
|
11
11
|
},
|
12
12
|
{
|
13
|
-
"d": 3
|
13
|
+
"d": 3,
|
14
|
+
"e": {
|
15
|
+
"f": "g"
|
16
|
+
}
|
14
17
|
}
|
15
18
|
]
|
16
19
|
}
|
@@ -22,4 +25,5 @@ describe JsonPaths do
|
|
22
25
|
specify { expect(subject.paths).to include("$.a[0].b") }
|
23
26
|
specify { expect(subject.paths).to include("$.a[0].c") }
|
24
27
|
specify { expect(subject.paths).to include("$.a[1].d") }
|
28
|
+
specify { expect(subject.paths).to include("$.a[1].e.f") }
|
25
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_paths
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Pruitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|