enforces data encapsulation in vool tree

gets rid of attraccessor
This commit is contained in:
Torsten Ruger
2017-04-06 16:06:51 +03:00
parent b9caad937a
commit 3fe286b5ed
9 changed files with 41 additions and 45 deletions

View File

@ -1,9 +1,17 @@
module Vool
class WhileStatement < Statement
attr_accessor :condition , :statements
attr_reader :condition , :statements
def initialize( condition )
def initialize( condition , statements )
@condition = condition
@statements = statements
simplify_condition
end
def simplify_condition
return unless @condition.is_a?(ScopeStatement)
@condition = @condition.first if @condition.single?
end
end
end