testing to_s
This commit is contained in:
parent
266764be06
commit
9226de4502
@ -5,6 +5,9 @@ module Typed
|
|||||||
def initialize(n = nil , v = nil )
|
def initialize(n = nil , v = nil )
|
||||||
@name , @value = n , v
|
@name , @value = n , v
|
||||||
end
|
end
|
||||||
|
def to_s
|
||||||
|
"#{name} = #{value}\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
module Typed
|
module Typed
|
||||||
class Statements < Statement
|
class Statements < Statement
|
||||||
attr_accessor :statements
|
attr_accessor :statements
|
||||||
|
def to_s
|
||||||
|
return "" unless statements
|
||||||
|
statements.collect() { |s| s.to_s }.join
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ module Typed
|
|||||||
attr_accessor :branch_type , :condition , :statements
|
attr_accessor :branch_type , :condition , :statements
|
||||||
def to_s
|
def to_s
|
||||||
str = "while_#{branch_type}(#{condition}) do\n"
|
str = "while_#{branch_type}(#{condition}) do\n"
|
||||||
str + statements.join(" ") + "\nend\n"
|
str + statements.to_s + "\nend\n"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user