jmespath 1.1.1 → 1.1.2
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 +4 -4
- data/lib/jmespath/nodes.rb +2 -0
- data/lib/jmespath/nodes/comparator.rb +32 -29
- data/lib/jmespath/nodes/condition.rb +6 -6
- data/lib/jmespath/version.rb +1 -1
- 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: 19c5b88355ab37717abe9fd6889620749d9affe2
|
4
|
+
data.tar.gz: 15d6e2545f4a90599ee6de98d3ab48362e2314f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d29161692e5f7728f85d5d406b70519ba02a40e62d279ea8800c5ab9f6e678f33a07a0bbcf8df2c90d68d6956363d439514fc1381950a4e5521948b7d0d91e1
|
7
|
+
data.tar.gz: 299455d9553de53a802a3ce4375ed652747b8258bfcaaeca47b2a897ae2cc946d53c88ac015c2e911babea432f2b096345470b050a3dc0a21145ca8ba035be3a
|
data/lib/jmespath/nodes.rb
CHANGED
@@ -19,6 +19,7 @@ module JMESPath
|
|
19
19
|
end
|
20
20
|
|
21
21
|
autoload :Comparator, 'jmespath/nodes/comparator'
|
22
|
+
autoload :Comparators, 'jmespath/nodes/comparator'
|
22
23
|
autoload :Condition, 'jmespath/nodes/condition'
|
23
24
|
autoload :Current, 'jmespath/nodes/current'
|
24
25
|
autoload :Expression, 'jmespath/nodes/expression'
|
@@ -36,5 +37,6 @@ module JMESPath
|
|
36
37
|
autoload :ObjectProjection, 'jmespath/nodes/projection'
|
37
38
|
autoload :Slice, 'jmespath/nodes/slice'
|
38
39
|
autoload :Subexpression, 'jmespath/nodes/subexpression'
|
40
|
+
|
39
41
|
end
|
40
42
|
end
|
@@ -12,12 +12,12 @@ module JMESPath
|
|
12
12
|
def self.create(relation, left, right)
|
13
13
|
type = begin
|
14
14
|
case relation
|
15
|
-
when '==' then
|
16
|
-
when '!=' then
|
17
|
-
when '>' then
|
18
|
-
when '>=' then
|
19
|
-
when '<' then
|
20
|
-
when '<=' then
|
15
|
+
when '==' then Comparators::Eq
|
16
|
+
when '!=' then Comparators::Neq
|
17
|
+
when '>' then Comparators::Gt
|
18
|
+
when '>=' then Comparators::Gte
|
19
|
+
when '<' then Comparators::Lt
|
20
|
+
when '<=' then Comparators::Lte
|
21
21
|
end
|
22
22
|
end
|
23
23
|
type.new(left, right)
|
@@ -38,39 +38,42 @@ module JMESPath
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
module Comparators
|
42
|
+
|
43
|
+
class Eq < Comparator
|
44
|
+
def check(left_value, right_value)
|
45
|
+
left_value == right_value
|
46
|
+
end
|
44
47
|
end
|
45
|
-
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
49
|
+
class Neq < Comparator
|
50
|
+
def check(left_value, right_value)
|
51
|
+
left_value != right_value
|
52
|
+
end
|
50
53
|
end
|
51
|
-
end
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
-
|
55
|
+
class Gt < Comparator
|
56
|
+
def check(left_value, right_value)
|
57
|
+
left_value.is_a?(Integer) && right_value.is_a?(Integer) && left_value > right_value
|
58
|
+
end
|
56
59
|
end
|
57
|
-
end
|
58
60
|
|
59
|
-
|
60
|
-
|
61
|
-
|
61
|
+
class Gte < Comparator
|
62
|
+
def check(left_value, right_value)
|
63
|
+
left_value.is_a?(Integer) && right_value.is_a?(Integer) && left_value >= right_value
|
64
|
+
end
|
62
65
|
end
|
63
|
-
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
-
|
67
|
+
class Lt < Comparator
|
68
|
+
def check(left_value, right_value)
|
69
|
+
left_value.is_a?(Integer) && right_value.is_a?(Integer) && left_value < right_value
|
70
|
+
end
|
68
71
|
end
|
69
|
-
end
|
70
72
|
|
71
|
-
|
72
|
-
|
73
|
-
|
73
|
+
class Lte < Comparator
|
74
|
+
def check(left_value, right_value)
|
75
|
+
left_value.is_a?(Integer) && right_value.is_a?(Integer) && left_value <= right_value
|
76
|
+
end
|
74
77
|
end
|
75
78
|
end
|
76
79
|
end
|
@@ -40,7 +40,7 @@ module JMESPath
|
|
40
40
|
end
|
41
41
|
|
42
42
|
class EqCondition < ComparatorCondition
|
43
|
-
COMPARATOR_TO_CONDITION[
|
43
|
+
COMPARATOR_TO_CONDITION[Comparators::Eq] = self
|
44
44
|
|
45
45
|
def visit(value)
|
46
46
|
@left.visit(value) == @right.visit(value) ? @child.visit(value) : nil
|
@@ -67,7 +67,7 @@ module JMESPath
|
|
67
67
|
end
|
68
68
|
|
69
69
|
class NeqCondition < ComparatorCondition
|
70
|
-
COMPARATOR_TO_CONDITION[
|
70
|
+
COMPARATOR_TO_CONDITION[Comparators::Neq] = self
|
71
71
|
|
72
72
|
def visit(value)
|
73
73
|
@left.visit(value) != @right.visit(value) ? @child.visit(value) : nil
|
@@ -94,7 +94,7 @@ module JMESPath
|
|
94
94
|
end
|
95
95
|
|
96
96
|
class GtCondition < ComparatorCondition
|
97
|
-
COMPARATOR_TO_CONDITION[
|
97
|
+
COMPARATOR_TO_CONDITION[Comparators::Gt] = self
|
98
98
|
|
99
99
|
def visit(value)
|
100
100
|
left_value = @left.visit(value)
|
@@ -104,7 +104,7 @@ module JMESPath
|
|
104
104
|
end
|
105
105
|
|
106
106
|
class GteCondition < ComparatorCondition
|
107
|
-
COMPARATOR_TO_CONDITION[
|
107
|
+
COMPARATOR_TO_CONDITION[Comparators::Gte] = self
|
108
108
|
|
109
109
|
def visit(value)
|
110
110
|
left_value = @left.visit(value)
|
@@ -114,7 +114,7 @@ module JMESPath
|
|
114
114
|
end
|
115
115
|
|
116
116
|
class LtCondition < ComparatorCondition
|
117
|
-
COMPARATOR_TO_CONDITION[
|
117
|
+
COMPARATOR_TO_CONDITION[Comparators::Lt] = self
|
118
118
|
|
119
119
|
def visit(value)
|
120
120
|
left_value = @left.visit(value)
|
@@ -124,7 +124,7 @@ module JMESPath
|
|
124
124
|
end
|
125
125
|
|
126
126
|
class LteCondition < ComparatorCondition
|
127
|
-
COMPARATOR_TO_CONDITION[
|
127
|
+
COMPARATOR_TO_CONDITION[Comparators::Lte] = self
|
128
128
|
|
129
129
|
def visit(value)
|
130
130
|
left_value = @left.visit(value)
|
data/lib/jmespath/version.rb
CHANGED
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.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trevor Rowe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|