Class: Estreet::WhileStatement

Inherits:
Statement show all
Defined in:
lib/estreet/loops.rb

Direct Known Subclasses

DoWhileStatement

Instance Attribute Summary

Attributes inherited from Node

#source_location

Instance Method Summary collapse

Methods inherited from Statement

#<<, #to_statement

Methods inherited from Node

#as_json, #loc, #type

Constructor Details

#initialize(test, body) ⇒ WhileStatement

Returns a new instance of WhileStatement.



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

def initialize(test, body)
  @test = test.to_expression
  @body = body.to_statement
end

Instance Method Details

#attributesObject



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

def attributes
  super.merge(test: @test, body: @body)
end