jsonpath 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/jsonpath/parser.rb +1 -0
- data/lib/jsonpath/version.rb +1 -1
- data/test/test_jsonpath.rb +3 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1dcbbacec3f46ae20e35ed77388c04a88ad1ef71
|
4
|
+
data.tar.gz: 57aa1fec4c9556b8553521050c36bf8b18da6426
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17d51a6fefe97232268f2fd393de4a2df23bd777a80207fbab5a5acce2259348e0683500b9e38c911f60fcf9dc55200c943c388a5c61044fc15e0c337838851d
|
7
|
+
data.tar.gz: 62a738bdde2652f8c8936c11fe1ed300f87bd6d9b758b3d79f190370bd04cb91c7336a8e9bc8e2268a258782f6e12badfe1a5647fd98eed00f4fa30cd807136a
|
data/lib/jsonpath/parser.rb
CHANGED
@@ -53,6 +53,7 @@ class JsonPath
|
|
53
53
|
|
54
54
|
# @TODO: Remove this once JsonPath no longer supports ruby versions below 2.3
|
55
55
|
def dig(keys, hash)
|
56
|
+
return hash unless hash.is_a? Hash
|
56
57
|
return nil unless hash.key?(keys.first)
|
57
58
|
return hash.fetch(keys.first) if keys.size == 1
|
58
59
|
prev = keys.shift
|
data/lib/jsonpath/version.rb
CHANGED
data/test/test_jsonpath.rb
CHANGED
@@ -255,10 +255,9 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
255
255
|
JsonPath.new("$.store._links").on(@object)
|
256
256
|
end
|
257
257
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
# end
|
258
|
+
def test_dig_return_string
|
259
|
+
assert_equal ['asdf'], JsonPath.new("$.store.book..tags[?(@ == 'asdf')]").on(@object)
|
260
|
+
end
|
262
261
|
|
263
262
|
def example_object
|
264
263
|
{ 'store' => {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonpath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Hull
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-05-
|
12
|
+
date: 2017-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project: jsonpath
|
146
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.5.1
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Ruby implementation of http://goessner.net/articles/JsonPath/
|