jsonpath 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,6 +43,7 @@ class JsonPath
43
43
  end
44
44
  else
45
45
  if node.is_a?(Array)
46
+ next if node.empty?
46
47
  array_args = sub_path.split(':')
47
48
  if array_args[0] == ?*
48
49
  start_idx = 0
@@ -1,3 +1,3 @@
1
1
  class JsonPath
2
- VERSION = '0.5.3'
2
+ VERSION = '0.5.4'
3
3
  end
@@ -134,6 +134,11 @@ class TestJsonpath < MiniTest::Unit::TestCase
134
134
  assert_equal @object['store']['book'].collect{|e| e['price']}, JsonPath.on(@object, '$..book[*].price')
135
135
  end
136
136
 
137
+ def test_wildcard_empty_array
138
+ object = @object.merge("bicycle" => { "tire" => [] })
139
+ assert_equal [], JsonPath.on(object, "$..bicycle.tire[*]")
140
+ end
141
+
137
142
  def test_support_filter_by_childnode_value
138
143
  assert_equal [@object['store']['book'][3]], JsonPath.new("$..book[?(@.price > 20)]").on(@object)
139
144
  end
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.3
4
+ version: 0.5.4
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-06-27 00:00:00.000000000 Z
12
+ date: 2013-08-22 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: 1436116661824722902
148
+ hash: -601431146046760901
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements: