Class: JMESPath::Nodes::Comparator Private
- Defined in:
- lib/jmespath/nodes/comparator.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
EqComparator, GtComparator, GteComparator, LtComparator, LteComparator, NeqComparator
Instance Attribute Summary collapse
- #left ⇒ Object readonly private
- #right ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(left, right) ⇒ Comparator
constructor
private
A new instance of Comparator.
- #optimize ⇒ Object private
- #visit(value) ⇒ Object private
Methods inherited from Node
Constructor Details
#initialize(left, right) ⇒ Comparator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Comparator.
7 8 9 10 |
# File 'lib/jmespath/nodes/comparator.rb', line 7 def initialize(left, right) @left = left @right = right end |
Instance Attribute Details
#left ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/jmespath/nodes/comparator.rb', line 5 def left @left end |
#right ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 |
# File 'lib/jmespath/nodes/comparator.rb', line 5 def right @right end |
Class Method Details
.create(relation, left, right) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/jmespath/nodes/comparator.rb', line 12 def self.create(relation, left, right) type = begin case relation when '==' then EqComparator when '!=' then NeqComparator when '>' then GtComparator when '>=' then GteComparator when '<' then LtComparator when '<=' then LteComparator end end type.new(left, right) end |
Instance Method Details
#optimize ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/jmespath/nodes/comparator.rb', line 30 def optimize self.class.new(@left.optimize, @right.optimize) end |
#visit(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/jmespath/nodes/comparator.rb', line 26 def visit(value) check(@left.visit(value), @right.visit(value)) end |