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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c81ddcbb6e1a1224f9a068866f731a119a26806
4
- data.tar.gz: 7147c3700e548741223faf65f81c570a8d3e1790
3
+ metadata.gz: 86c55c63011d6bd71967469b464bfeb537f7c54f
4
+ data.tar.gz: 57d966160fa4106318d122cc2e088a9032925d47
5
5
  SHA512:
6
- metadata.gz: c3d4e55012e0ab3e1b969e89bb8ac3e4450178c0954710eaf06b214a4973a796186a1cd976f6fbc211723ca7061e74f0e600650f2252d77b87c8b40109fa5494
7
- data.tar.gz: e993c5f494bc2910728d3da43ab3e0933808a5824c7d057c23ba0fa38ce04cd72fa76898058c5c48702ae8418ead5eb898b9dbd38d643f630bcc3423992aa881
6
+ metadata.gz: 4e96817450882137b8907cd90bec5564a3ecd21da7803ca11034ae4a8c4b2a65bdc661efe0b210858af3b4a71e029d8689cbf30f5cefe2beb8047a9b2e07ffc4
7
+ data.tar.gz: 050745e85fe208a99a963c54eac2426cdfaf701a9f6658e6cd2f5683bfa0730af1cf690a92e0d3fc8bb006afa8f8a2221c99d92178944689bb7f1b0efc35e095
@@ -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}']"
@@ -1,3 +1,3 @@
1
1
  class JsonPath
2
- VERSION = '0.7.1'.freeze
2
+ VERSION = '0.7.2'.freeze
3
3
  end
@@ -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.1
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-07 00:00:00.000000000 Z
12
+ date: 2017-05-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json