Class: NodeQuery::Compiler::ArrayValue
- Inherits:
-
Object
- Object
- NodeQuery::Compiler::ArrayValue
- Includes:
- Comparable
- Defined in:
- lib/node_query/compiler/array_value.rb
Overview
ArrayValue represents a ruby array value.
Constant Summary
Constants included from Comparable
Comparable::ARRAY_VALID_OPERATORS, Comparable::NUMBER_VALID_OPERATORS, Comparable::REGEXP_VALID_OPERATORS, Comparable::SIMPLE_VALID_OPERATORS, Comparable::STRING_VALID_OPERATORS
Instance Method Summary collapse
-
#expected_value(base_node) ⇒ Array
Get the expected value.
-
#initialize(value: nil, rest: nil, adapter:) ⇒ ArrayValue
constructor
Initialize an Array.
- #to_s ⇒ Object
-
#valid_operators ⇒ Array
Get valid operators.
Methods included from Comparable
#actual_value, #is_equal?, #match?, #valid_operator?
Constructor Details
#initialize(value: nil, rest: nil, adapter:) ⇒ ArrayValue
Initialize an Array.
12 13 14 15 16 |
# File 'lib/node_query/compiler/array_value.rb', line 12 def initialize(value: nil, rest: nil, adapter:) @value = value @rest = rest @adapter = adapter end |
Instance Method Details
#expected_value(base_node) ⇒ Array
Get the expected value.
20 21 22 23 24 25 |
# File 'lib/node_query/compiler/array_value.rb', line 20 def expected_value(base_node) expected = [] expected.push(@value) if @value expected += @rest.expected_value(base_node) if @rest expected end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/node_query/compiler/array_value.rb', line 33 def to_s [@value, @rest].compact.join(' ') end |
#valid_operators ⇒ Array
Get valid operators.
29 30 31 |
# File 'lib/node_query/compiler/array_value.rb', line 29 def valid_operators ARRAY_VALID_OPERATORS end |