jsonpath 0.7.1 → 0.7.2
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/enumerable.rb +1 -2
- data/lib/jsonpath/version.rb +1 -1
- data/test/test_jsonpath.rb +4 -0
- 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: 86c55c63011d6bd71967469b464bfeb537f7c54f
|
4
|
+
data.tar.gz: 57d966160fa4106318d122cc2e088a9032925d47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e96817450882137b8907cd90bec5564a3ecd21da7803ca11034ae4a8c4b2a65bdc661efe0b210858af3b4a71e029d8689cbf30f5cefe2beb8047a9b2e07ffc4
|
7
|
+
data.tar.gz: 050745e85fe208a99a963c54eac2426cdfaf701a9f6658e6cd2f5683bfa0730af1cf690a92e0d3fc8bb006afa8f8a2221c99d92178944689bb7f1b0efc35e095
|
data/lib/jsonpath/enumerable.rb
CHANGED
@@ -115,7 +115,7 @@ class JsonPath
|
|
115
115
|
return Integer(exp) if exp[0] != '('
|
116
116
|
return nil unless allow_eval? && @_current_node
|
117
117
|
|
118
|
-
identifiers = /@?(\.(\w+))+/.match(exp)
|
118
|
+
identifiers = /@?((?<!\d)\.(?!\d)(\w+))+/.match(exp)
|
119
119
|
# puts JsonPath.on(@_current_node, "#{identifiers}") unless identifiers.nil? ||
|
120
120
|
# @_current_node
|
121
121
|
# .methods
|
@@ -123,7 +123,6 @@ class JsonPath
|
|
123
123
|
|
124
124
|
unless identifiers.nil? ||
|
125
125
|
@_current_node.methods.include?(identifiers[2].to_sym)
|
126
|
-
|
127
126
|
exp_to_eval = exp.dup
|
128
127
|
exp_to_eval[identifiers[0]] = identifiers[0].split('.').map do |el|
|
129
128
|
el == '@' ? '@_current_node' : "['#{el}']"
|
data/lib/jsonpath/version.rb
CHANGED
data/test/test_jsonpath.rb
CHANGED
@@ -76,6 +76,10 @@ 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 test_eval_with_floating_point
|
80
|
+
assert_equal [@object['store']['book'][1]], JsonPath.new("$..book[?(@['price'] < 23.0 && @['price'] > 9.0)]").on(@object)
|
81
|
+
end
|
82
|
+
|
79
83
|
def test_no_eval
|
80
84
|
assert_equal [], JsonPath.new('$..book[(@.length-2)]', allow_eval: false).on(@object)
|
81
85
|
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.7.
|
4
|
+
version: 0.7.2
|
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-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|