Class: Estreet::VariableDeclarator

Inherits:
Node
  • Object
show all
Defined in:
lib/estreet/variable_declaration.rb

Instance Attribute Summary

Attributes inherited from Node

#source_location

Instance Method Summary collapse

Methods inherited from Node

#as_json, #loc, #type

Constructor Details

#initialize(ident, init) ⇒ VariableDeclarator

Returns a new instance of VariableDeclarator.



19
20
21
22
# File 'lib/estreet/variable_declaration.rb', line 19

def initialize(ident, init)
  @ident = ident.to_pattern
  @init  = init.to_expression if init
end

Instance Method Details

#attributesObject



24
25
26
# File 'lib/estreet/variable_declaration.rb', line 24

def attributes
  super.merge(id: @ident, init: @init)
end