Class: JMESPath::Nodes::Index Private

Inherits:
Field show all
Defined in:
lib/jmespath/nodes/index.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 Field

#chain, #chains_with?

Methods inherited from Node

#chains_with?, #hash_like?, #optimize

Constructor Details

#initialize(index) ⇒ Index

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



5
6
7
# File 'lib/jmespath/nodes/index.rb', line 5

def initialize(index)
  super(index)
end

Instance Method Details

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



9
10
11
12
13
14
15
# File 'lib/jmespath/nodes/index.rb', line 9

def visit(value)
  if value.is_a?(Array)
    value[@key]
  else
    nil
  end
end