class Estreet::ForStatement

Public Class Methods

new(init, test, update, body) click to toggle source
# 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

Public Instance Methods

attributes() click to toggle source
Calls superclass method
# File lib/estreet/loops.rb, line 28
def attributes
  super.merge(init: @init, test: @test, update: @update, body: @body)
end