testing to_s

This commit is contained in:
Torsten Ruger 2016-12-28 14:11:05 +02:00
parent 266764be06
commit 9226de4502
3 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,9 @@ module Typed
def initialize(n = nil , v = nil )
@name , @value = n , v
end
def to_s
"#{name} = #{value}\n"
end
end
end
end

View File

@ -1,5 +1,9 @@
module Typed
class Statements < Statement
attr_accessor :statements
def to_s
return "" unless statements
statements.collect() { |s| s.to_s }.join
end
end
end

View File

@ -4,7 +4,7 @@ module Typed
attr_accessor :branch_type , :condition , :statements
def to_s
str = "while_#{branch_type}(#{condition}) do\n"
str + statements.join(" ") + "\nend\n"
str + statements.to_s + "\nend\n"
end
end
end