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 collapse
-
#next ⇒ Object
Subsequent expression that modifies the result of this selector list.
Attributes inherited from Expression
Instance Method Summary collapse
Methods inherited from Selector
Methods inherited from Expression
#indented, #initialize, #literal?, #singular_query?, #type
Constructor Details
This class inherits a constructor from Janeway::AST::Expression
Instance Attribute Details
#next ⇒ Object
Subsequent expression that modifies the result of this selector list.
20 21 22 |
# File 'lib/janeway/ast/descendant_segment.rb', line 20 def next @next end |
Instance Method Details
#selector ⇒ AST::Selector
28 29 30 |
# File 'lib/janeway/ast/descendant_segment.rb', line 28 def selector value end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/janeway/ast/descendant_segment.rb', line 22 def to_s "..#{@next&.to_s(dot_prefix: false)}" end |
#tree(level) ⇒ Array
34 35 36 |
# File 'lib/janeway/ast/descendant_segment.rb', line 34 def tree(level) [indented(level, "..#{@value}"), @next&.tree(level + 1)] end |