Class: JMESPath::Nodes::SimpleSlice Private
- 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
-
#initialize(start, stop) ⇒ SimpleSlice
constructor
private
A new instance of SimpleSlice.
- #visit(value) ⇒ Object private
Methods inherited from Slice
Methods inherited from Node
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.
75 76 77 |
# File 'lib/jmespath/nodes/slice.rb', line 75 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.
79 80 81 82 83 |
# File 'lib/jmespath/nodes/slice.rb', line 79 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] end end |