Class: Estreet::ObjectExpression

Inherits:
Expression show all
Defined in:
lib/estreet/object_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(properties) ⇒ ObjectExpression

Returns a new instance of ObjectExpression.

Raises:

  • (TypeError)


3
4
5
6
# File 'lib/estreet/object_expression.rb', line 3

def initialize(properties)
  raise TypeError unless properties.all? {|p| p.is_a? Property }
  @props = properties
end

Instance Method Details

#attributesObject



8
9
10
# File 'lib/estreet/object_expression.rb', line 8

def attributes
  super.merge(properties: @props)
end