Class: Janeway::AST::RootNode
- Inherits:
-
Expression
- Object
- Expression
- Janeway::AST::RootNode
- Defined in:
- lib/janeway/ast/root_node.rb
Overview
Every JSONPath query (except those inside filter expressions; see Section 2.3.5) MUST begin with the root identifier $.
The root identifier $ represents the root node of the query argument and produces a nodelist consisting of that root node.
The root identifier may also be used in the filter selectors.
@example:
$(? $.key1 == $.key2 )
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
-
#singular_query? ⇒ Boolean
True if this is the root of a singular-query.
- #to_s ⇒ Object
- #tree(level = 0) ⇒ Array
Methods inherited from Expression
#chain_of?, #indented, #initialize, #literal?, #type, type_name
Constructor Details
This class inherits a constructor from Janeway::AST::Expression
Instance Method Details
#singular_query? ⇒ Boolean
True if this is the root of a singular-query.
25 26 27 |
# File 'lib/janeway/ast/root_node.rb', line 25 def singular_query? chain_of?(AST::IndexSelector, AST::NameSelector) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/janeway/ast/root_node.rb', line 17 def to_s "$#{@next}" end |
#tree(level = 0) ⇒ Array
31 32 33 |
# File 'lib/janeway/ast/root_node.rb', line 31 def tree(level = 0) [indented(level, '$'), @next&.tree(level + 1)] end |