rubyx/lib/mom/statement.rb
Torsten Ruger f7aac1d1a4 polish docs
and a bit of code style
2018-03-11 16:11:15 +05:30

27 lines
522 B
Ruby

module Mom
class Statement
# flattening will change the structure from a tree to a linked list (and use
# nekst to do so)
def flatten
raise "not implemented for #{self}"
end
end
class Statements < Statement
include Common::Statements
def flatten( options = {} )
flat = @statements.pop.flatten
while( nekst = @statements.pop )
flat.append nekst.flatten()
end
flat
end
end
end
require_relative "if_statement"
require_relative "while_statement"