jsonpath 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -1
- data/lib/jsonpath/enumerable.rb +3 -0
- data/lib/jsonpath/version.rb +1 -1
- data/test/test_jsonpath.rb +4 -0
- metadata +4 -4
data/lib/jsonpath/enumerable.rb
CHANGED
@@ -52,6 +52,9 @@ class JsonPath
|
|
52
52
|
next unless start_idx
|
53
53
|
end_idx = (array_args[1] && process_function_or_literal(array_args[1], -1) || (sub_path.count(':') == 0 ? start_idx : -1))
|
54
54
|
next unless end_idx
|
55
|
+
if start_idx == end_idx
|
56
|
+
next unless start_idx < node.size
|
57
|
+
end
|
55
58
|
end
|
56
59
|
start_idx %= node.size
|
57
60
|
end_idx %= node.size
|
data/lib/jsonpath/version.rb
CHANGED
data/test/test_jsonpath.rb
CHANGED
@@ -9,6 +9,10 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
9
9
|
assert_equal 4, JsonPath.new('$.store.*').on(@object).first['book'].size
|
10
10
|
end
|
11
11
|
|
12
|
+
def test_lookup_missing_element
|
13
|
+
assert_equal [], JsonPath.new('$.store.book[99].price').on(@object)
|
14
|
+
end
|
15
|
+
|
12
16
|
def test_retrieve_all_authors
|
13
17
|
assert_equal [
|
14
18
|
@object['store']['book'][0]['author'],
|
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.5.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
@@ -145,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
segments:
|
147
147
|
- 0
|
148
|
-
hash:
|
148
|
+
hash: 1436116661824722902
|
149
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
150
|
none: false
|
151
151
|
requirements:
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project: jsonpath
|
157
|
-
rubygems_version: 1.8.
|
157
|
+
rubygems_version: 1.8.25
|
158
158
|
signing_key:
|
159
159
|
specification_version: 3
|
160
160
|
summary: Ruby implementation of http://goessner.net/articles/JsonPath/
|