class JMESPath::Nodes::SimpleSlice

Public Class Methods

new(start, stop) click to toggle source
Calls superclass method JMESPath::Nodes::Slice::new
# File lib/jmespath/nodes/slice.rb, line 78
def initialize(start, stop)
  super(start, stop, 1)
end

Public Instance Methods

visit(value) click to toggle source
# File lib/jmespath/nodes/slice.rb, line 82
def visit(value)
  if (value = value.respond_to?(:to_str) ? value.to_str : value.respond_to?(:to_ary) ? value.to_ary : nil)
    value[@start, @stop - @start]
  else
    nil
  end
end