Sha256: 80671f483f888567d641cc40808f5b6a9384ad689cfadd16643d9c0192ba8ae8

Contents?: true

Size: 728 Bytes

Versions: 5

Compression:

Stored size: 728 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

5 entries across 5 versions & 1 rubygems

Version Path
synvert-core-1.4.0 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.3.1 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.3.0 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.2.1 lib/synvert/core/node_query/compiler/array.rb
synvert-core-1.2.0 lib/synvert/core/node_query/compiler/array.rb