Class: Janeway::AST::Selector

Inherits:
Expression show all
Defined in:
lib/janeway/ast/selector.rb

Overview

Represent a selector, which is an expression that filters nodes from a list based on a predicate.

www.rfc-editor.org/rfc/rfc9535.html#name-selectors Selectors:

A name selector, e.g. ‘name’, selects a named child of an object.

An index selector, e.g. 3, selects an indexed child of an array.

A wildcard * in the expression [*] selects all children of a node and in the expression ..[*] selects all descendants of a node.

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.

Filter expressions ?<logical-expr> select certain children of an object or array, as in:

$.store.book[[email protected] < 10].title

Instance Attribute Summary collapse

Attributes inherited from Expression

#value

Instance Method Summary collapse

Methods inherited from Expression

#indented, #initialize, #literal?, #singular_query?, #tree, #type

Constructor Details

This class inherits a constructor from Janeway::AST::Expression

Instance Attribute Details

#nextObject

Subsequent expression that modifies the result of this selector list.



27
28
29
# File 'lib/janeway/ast/selector.rb', line 27

def next
  @next
end

Instance Method Details

#==(other) ⇒ Object



29
30
31
# File 'lib/janeway/ast/selector.rb', line 29

def ==(other)
  value == other&.value
end