jsonpath 0.8.4 → 0.8.5
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/jsonpath/parser.rb +1 -1
- data/lib/jsonpath/version.rb +1 -1
- data/test/test_jsonpath.rb +10 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21fea8b1a9938a71633574563954589ec16dcdf0
|
4
|
+
data.tar.gz: 62627c4ceb79e873a9bcc7a98882bd6637648844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93c07f6532086fd40fe7f1df0d9d829256644b1ce070aa3924333f379df383bf824ba82b91479eb7c94e12e9ecbdd87498bc793dc7681ba8601dc33f8069b13a
|
7
|
+
data.tar.gz: 7d43c2ecac3f114872c37ec21b383b1974b81f3350ac29298dd0f7bd377ffef3890ac7a4f7b5ba25cbd1d1f9498745aa3de119f789b49803eb1c47e96558d864
|
data/lib/jsonpath/parser.rb
CHANGED
@@ -46,7 +46,7 @@ class JsonPath
|
|
46
46
|
return false unless el
|
47
47
|
return true if operator.nil? && el
|
48
48
|
|
49
|
-
operand = operand
|
49
|
+
operand = Float(operand) rescue operand
|
50
50
|
el.send(operator.strip, operand)
|
51
51
|
end
|
52
52
|
|
data/lib/jsonpath/version.rb
CHANGED
data/test/test_jsonpath.rb
CHANGED
@@ -76,7 +76,7 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
76
76
|
assert_equal [@object['store']['book'][1]], JsonPath.new("$..book[?(@['price'] < 23 && @['price'] > 9)]").on(@object)
|
77
77
|
end
|
78
78
|
|
79
|
-
def
|
79
|
+
def test_eval_with_floating_point_and_and
|
80
80
|
assert_equal [@object['store']['book'][1]], JsonPath.new("$..book[?(@['price'] < 23.0 && @['price'] > 9.0)]").on(@object)
|
81
81
|
end
|
82
82
|
|
@@ -269,6 +269,15 @@ class TestJsonpath < MiniTest::Unit::TestCase
|
|
269
269
|
assert_equal [{ 'type' => 'mps/awesome' }], JsonPath.new("$.data[?(@.type == \"mps/awesome\")]").on(data)
|
270
270
|
end
|
271
271
|
|
272
|
+
def test_floating_point_with_precision_marker
|
273
|
+
data = {
|
274
|
+
'data' => {
|
275
|
+
'type' => 0.00001
|
276
|
+
}
|
277
|
+
}
|
278
|
+
assert_equal [{"type"=>0.00001}], JsonPath.new("$.data[?(@.type == 0.00001)]").on(data)
|
279
|
+
end
|
280
|
+
|
272
281
|
def example_object
|
273
282
|
{ 'store' => {
|
274
283
|
'book' => [
|
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.5
|
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-06-
|
12
|
+
date: 2017-06-14 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.4.8
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Ruby implementation of http://goessner.net/articles/JsonPath/
|