Class: Estreet::ArrayExpression

Inherits:
Expression show all
Defined in:
lib/estreet/array_expression.rb

Instance Attribute Summary

Attributes inherited from Node

#source_location

Instance Method Summary collapse

Methods inherited from Expression

#[], #call, coerce, #property, #to_expression, #to_statement

Methods inherited from Node

#as_json, #loc, #type

Constructor Details

#initialize(elements) ⇒ ArrayExpression

Returns a new instance of ArrayExpression.



3
4
5
6
7
8
# File 'lib/estreet/array_expression.rb', line 3

def initialize(elements)
  @elements = elements.map do |e|
    # TODO: is it OK to coerce here?
    e.nil? ? e : Expression.coerce(e)
  end
end

Instance Method Details

#attributesObject



10
11
12
# File 'lib/estreet/array_expression.rb', line 10

def attributes
  super.merge(elements: @elements)
end