Class: Estreet::ForStatement
- Defined in:
- lib/estreet/loops.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(init, test, update, body) ⇒ ForStatement
constructor
A new instance of ForStatement.
Methods inherited from Statement
Methods inherited from Node
Constructor Details
#initialize(init, test, update, body) ⇒ ForStatement
Returns a new instance of ForStatement.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/estreet/loops.rb', line 16 def initialize(init, test, update, body) # TODO: respond_to to_declaration, maybe? raise TypeError unless init.is_a?(VariableDeclaration) || init.is_a?(Expression) || init.nil? @init = init if init @test = test.to_expression if test @update = update.to_expression if update @body = body.to_statement end |
Instance Method Details
#attributes ⇒ Object
28 29 30 |
# File 'lib/estreet/loops.rb', line 28 def attributes super.merge(init: @init, test: @test, update: @update, body: @body) end |