Class: JMESPath::Nodes::Projection Private

Inherits:
Node
  • Object
show all
Defined in:
lib/jmespath/nodes/projection.rb

Overview

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.

API:

  • private

Direct Known Subclasses

ArrayProjection, ObjectProjection

Instance Method Summary collapse

Methods inherited from Node

#chains_with?

Constructor Details

#initialize(target, projection) ⇒ Projection

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

API:

  • private



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

def initialize(target, projection)
  @target = target
  @projection = projection
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.

API:

  • private



22
23
24
25
26
27
28
# File 'lib/jmespath/nodes/projection.rb', line 22

def optimize
  if @projection.is_a?(Current)
    fast_instance
  else
    self.class.new(@target.optimize, @projection.optimize)
  end
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.

API:

  • private



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

def visit(value)
  if (targets = extract_targets(@target.visit(value)))
    list = []
    targets.each do |v|
      vv = @projection.visit(v)
      list << vv unless vv.nil?
    end
    list
  end
end