Sha256: a6308e660db5b615dd98b12d8dcb4da1d518c4ed695603543049eb0689c9c66b

Contents?: true

Size: 729 Bytes

Versions: 7

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

module Synvert::Core::NodeQuery::Compiler
  # Array represents a ruby array value.
  class Array
    include Comparable

    # Initialize an Array.
    # @param value the first value of the array
    # @param rest the rest value of the array
    def initialize(value: nil, rest: nil)
      @value = value
      @rest = rest
    end

    # Get the expected value.
    # @return [Array]
    def expected_value
      expected = []
      expected.push(@value) if @value
      expected += @rest.expected_value if @rest
      expected
    end

    # Get valid operators.
    def valid_operators
      ARRAY_VALID_OPERATORS
    end

    def to_s
      [@value, @rest].compact.join(', ')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
synvert-core-1.1.1 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.1.0 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.0.5 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.0.4 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.0.3 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.0.2 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.0.1 lib/synvert/core/node_query/compiler/array.rb