Class: JMESPath::Nodes::SimpleSlice Private

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

#optimize

Methods inherited from Node

#chains_with?, #hash_like?, #optimize

Constructor Details

#initialize(start, stop) ⇒ SimpleSlice

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



78
79
80
# File 'lib/jmespath/nodes/slice.rb', line 78

def initialize(start, stop)
  super(start, stop, 1)
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.



82
83
84
85
86
87
88
# File 'lib/jmespath/nodes/slice.rb', line 82

def visit(value)
  if String === value || Array === value
    value[@start, @stop - @start]
  else
    nil
  end
end