Class: Janeway::AST::DescendantSegment
- Inherits:
-
Selector
- Object
- Expression
- Selector
- Janeway::AST::DescendantSegment
- Defined in:
- lib/janeway/ast/descendant_segment.rb
Overview
An array slice start:end:step selects a series of elements from an array, giving a start position, an end position, and an optional step value that moves the position from the start to the end.
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
Methods inherited from Expression
#chain_of?, #indented, #initialize, #literal?, #singular_query?, #type, type_name
Constructor Details
This class inherits a constructor from Janeway::AST::Expression
Instance Method Details
#selector ⇒ AST::Selector
25 26 27 |
# File 'lib/janeway/ast/descendant_segment.rb', line 25 def selector value end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/janeway/ast/descendant_segment.rb', line 19 def to_s "..#{@next&.to_s(dot_prefix: false)}" end |
#tree(level) ⇒ Array
31 32 33 |
# File 'lib/janeway/ast/descendant_segment.rb', line 31 def tree(level) [indented(level, "..#{@value}"), @next&.tree(level + 1)] end |