Class: JMESPath::Nodes::Or Private

Inherits:
Node
  • Object
show all
Defined in:
lib/jmespath/nodes/or.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.

Instance Method Summary collapse

Methods inherited from Node

#chains_with?

Constructor Details

#initialize(left, right) ⇒ Or

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 Or.



6
7
8
9
# File 'lib/jmespath/nodes/or.rb', line 6

def initialize(left, right)
  @left = left
  @right = right
end

Instance Method Details

#optimizeObject

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.



20
21
22
# File 'lib/jmespath/nodes/or.rb', line 20

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.



11
12
13
14
15
16
17
18
# File 'lib/jmespath/nodes/or.rb', line 11

def visit(value)
  result = @left.visit(value)
  if JMESPath::Util.falsey?(result)
    @right.visit(value)
  else
    result
  end
end