jmespath 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jmespath might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da04f3f7da9e5cac47a01704bbbea262f42e573a
4
- data.tar.gz: 81a60303e553bd70b307fdc87b652f8b2f9bc3ab
3
+ metadata.gz: f2d08f64e74ad4927d6323f98b91486ad7d8f79c
4
+ data.tar.gz: ce7796a88dab9241efacdeac1a3b36c9083ff6ca
5
5
  SHA512:
6
- metadata.gz: 74bb5e454b3918e2df4f8007be7e2c2433d85b386f9a31a1476570e3f52b58840162dd4c4b33c52743315f640fbc9caf32985036193dd3127f0b9146e6bb616b
7
- data.tar.gz: 8d0c2d681686cae78b443480c6dbe12905d28289b4e032f5e572cc1a2c0b55c4d4abc2bb07da7466a8a737fe7300defc805c1298820e59c8aca19464de011b1d
6
+ metadata.gz: ca3d9a98c00cedf8b5bafdc70d3cdb8b2ee754ef85dfa270807650fa9517d50db68e513d3713d431ac8ac1b9bdb9757ca76b2758bc8ddfde1add3eedb08973e4
7
+ data.tar.gz: 7c09a5ee313e2f7feba1334c240fdc2a820eb9127d5e2db3392ac1dad3b29b2b8b4c55aee4f6c4309417d857df84f8854201a79ba5fe405d724f91a44db331d3
@@ -54,25 +54,41 @@ module JMESPath
54
54
 
55
55
  class Gt < Comparator
56
56
  def check(left_value, right_value)
57
- left_value.is_a?(Integer) && right_value.is_a?(Integer) && left_value > right_value
57
+ if left_value.is_a?(Numeric) && right_value.is_a?(Numeric)
58
+ left_value > right_value
59
+ else
60
+ nil
61
+ end
58
62
  end
59
63
  end
60
64
 
61
65
  class Gte < Comparator
62
66
  def check(left_value, right_value)
63
- left_value.is_a?(Integer) && right_value.is_a?(Integer) && left_value >= right_value
67
+ if left_value.is_a?(Numeric) && right_value.is_a?(Numeric)
68
+ left_value >= right_value
69
+ else
70
+ nil
71
+ end
64
72
  end
65
73
  end
66
74
 
67
75
  class Lt < Comparator
68
76
  def check(left_value, right_value)
69
- left_value.is_a?(Integer) && right_value.is_a?(Integer) && left_value < right_value
77
+ if left_value.is_a?(Numeric) && right_value.is_a?(Numeric)
78
+ left_value < right_value
79
+ else
80
+ nil
81
+ end
70
82
  end
71
83
  end
72
84
 
73
85
  class Lte < Comparator
74
86
  def check(left_value, right_value)
75
- left_value.is_a?(Integer) && right_value.is_a?(Integer) && left_value <= right_value
87
+ if left_value.is_a?(Numeric) && right_value.is_a?(Numeric)
88
+ left_value <= right_value
89
+ else
90
+ nil
91
+ end
76
92
  end
77
93
  end
78
94
  end
@@ -107,6 +107,7 @@ module JMESPath
107
107
  return maybe_raise Errors::InvalidArityError, "function avg() expects one argument"
108
108
  end
109
109
  if Array === values
110
+ return nil if values.empty?
110
111
  values.inject(0) do |total,n|
111
112
  if Numeric === n
112
113
  total + n
@@ -207,7 +208,7 @@ module JMESPath
207
208
  return maybe_raise Errors::InvalidTypeError, "function map() expects the second argument to be an list"
208
209
  end
209
210
  list.map { |value| expr.eval(value) }
210
- end
211
+ end
211
212
 
212
213
  end
213
214
 
@@ -59,7 +59,7 @@ module JMESPath
59
59
  # @param [Integer] rbp Right binding power
60
60
  def expr(stream, rbp = 0)
61
61
  left = send("nud_#{stream.token.type}", stream)
62
- while rbp < stream.token.binding_power
62
+ while rbp < (stream.token.binding_power || 0)
63
63
  left = send("led_#{stream.token.type}", stream, left)
64
64
  end
65
65
  left
@@ -1,3 +1,3 @@
1
1
  module JMESPath
2
- VERSION = '1.3.1'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jmespath
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Rowe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-18 00:00:00.000000000 Z
11
+ date: 2018-04-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Implements JMESPath for Ruby
14
14
  email: trevorrowe@gmail.com
@@ -48,7 +48,7 @@ files:
48
48
  - lib/jmespath/version.rb
49
49
  homepage: http://github.com/trevorrowe/jmespath.rb
50
50
  licenses:
51
- - Apache 2.0
51
+ - Apache-2.0
52
52
  metadata: {}
53
53
  post_install_message:
54
54
  rdoc_options: []
@@ -71,4 +71,3 @@ signing_key:
71
71
  specification_version: 4
72
72
  summary: JMESPath - Ruby Edition
73
73
  test_files: []
74
- has_rdoc: