Class: Synvert::Core::NodeQuery::Compiler::Array
- Inherits:
-
Object
- Object
- Synvert::Core::NodeQuery::Compiler::Array
- Includes:
- Comparable
- Defined in:
- lib/synvert/core/node_query/compiler/array.rb
Overview
Array 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
Instance Method Summary collapse
-
#expected_value ⇒ Array
Get the expected value.
-
#initialize(value: nil, rest: nil) ⇒ Array
constructor
Initialize an Array.
- #to_s ⇒ Object
-
#valid_operators ⇒ Object
Get valid operators.
Methods included from Comparable
#actual_value, #match?, #valid_operator?
Constructor Details
#initialize(value: nil, rest: nil) ⇒ Array
Initialize an Array.
11 12 13 14 |
# File 'lib/synvert/core/node_query/compiler/array.rb', line 11 def initialize(value: nil, rest: nil) @value = value @rest = rest end |
Instance Method Details
#expected_value ⇒ Array
Get the expected value.
18 19 20 21 22 23 |
# File 'lib/synvert/core/node_query/compiler/array.rb', line 18 def expected_value expected = [] expected.push(@value) if @value expected += @rest.expected_value if @rest expected end |
#to_s ⇒ Object
30 31 32 |
# File 'lib/synvert/core/node_query/compiler/array.rb', line 30 def to_s [@value, @rest].compact.join(', ') end |
#valid_operators ⇒ Object
Get valid operators.
26 27 28 |
# File 'lib/synvert/core/node_query/compiler/array.rb', line 26 def valid_operators ARRAY_VALID_OPERATORS end |