Class: Janeway::AST::FilterSelector
- Inherits:
-
Selector
- Object
- Expression
- Selector
- Janeway::AST::FilterSelector
- Defined in:
- lib/janeway/ast/filter_selector.rb
Overview
Filter selectors may use function extensions, which are covered in Section 2.4. Within the logical expression for a filter selector, function expressions can be used to operate on nodelists and values. The set of available functions is extensible, with a number of functions predefined (see Section 2.4) and the ability to register further functions provided by the “Function Extensions” subregistry (Section 3.2). When a function is defined, it is given a unique name, and its return value and each of its parameters are given a _declared type_. The type system is limited in scope; its purpose is to express restrictions that, without functions, are implicit in the grammar of filter expressions. The type system also guides conversions (Section 2.4.2) that mimic the way different kinds of expressions are handled in the grammar when function expressions are not in use.
@example: $.store[@.price < 10]
Instance Attribute Summary
Attributes inherited from Selector
Attributes inherited from Expression
Instance Method Summary collapse
-
#to_s(brackets: true) ⇒ Object
** ignores keyword arguments that don’t apply to this selector.
- #tree(level) ⇒ Array
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 Method Details
#to_s(brackets: true) ⇒ Object
** ignores keyword arguments that don’t apply to this selector
50 51 52 |
# File 'lib/janeway/ast/filter_selector.rb', line 50 def to_s(brackets: true, **) brackets ? "[?#{value}]#{@next}" : "?#{value}#{@next}" end |
#tree(level) ⇒ Array
56 57 58 59 60 61 62 |
# File 'lib/janeway/ast/filter_selector.rb', line 56 def tree(level) if @next [indented(level, to_s), @next.tree(level + 1)] else [indented(level, to_s)] end end |