jsonpath 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 458f8cfb291930dcf500cb378da87a4c5ea08ada
4
- data.tar.gz: 28cc08dea7e072cf946bd2384be4781abeb214f5
3
+ metadata.gz: 21fea8b1a9938a71633574563954589ec16dcdf0
4
+ data.tar.gz: 62627c4ceb79e873a9bcc7a98882bd6637648844
5
5
  SHA512:
6
- metadata.gz: 32b2d7550e5676ea6b1a4403633ffe8da9fd73638ca7ec87b556ab263e05788adf78a023fb488fddb22c14733d0f504abda74c9f26890037a635864908a8e146
7
- data.tar.gz: 35ac4056bc5d22ddc3192824d7e228f212aff357e2ae789908b7d855601c78c64a4678c188983873e173201b02c227651bdc7cca7fe86b608f53e5ce83d1d35c
6
+ metadata.gz: 93c07f6532086fd40fe7f1df0d9d829256644b1ce070aa3924333f379df383bf824ba82b91479eb7c94e12e9ecbdd87498bc793dc7681ba8601dc33f8069b13a
7
+ data.tar.gz: 7d43c2ecac3f114872c37ec21b383b1974b81f3350ac29298dd0f7bd377ffef3890ac7a4f7b5ba25cbd1d1f9498745aa3de119f789b49803eb1c47e96558d864
@@ -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.to_f if operand.to_i.to_s == operand || operand.to_f.to_s == operand
49
+ operand = Float(operand) rescue operand
50
50
  el.send(operator.strip, operand)
51
51
  end
52
52
 
@@ -1,3 +1,3 @@
1
1
  class JsonPath
2
- VERSION = '0.8.4'.freeze
2
+ VERSION = '0.8.5'.freeze
3
3
  end
@@ -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 test_eval_with_floating_point
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
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-10 00:00:00.000000000 Z
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.6.10
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/