lib/code/node/code.rb in template-ruby-0.4.0 vs lib/code/node/code.rb in template-ruby-0.5.0
- old
+ new
@@ -1,19 +1,17 @@
class Code
class Node
class Code < Node
- def initialize(statements)
- statements = [] if statements.to_s.blank?
-
- @statements =
- statements.map { |statement| ::Code::Node::Statement.new(statement) }
+ def initialize(parsed)
+ @statements = parsed.map { |statement| Node::Statement.new(statement) }
end
def evaluate(**args)
last = ::Code::Object::Nothing.new
@statements.each do |statement|
- last = statement.evaluate(**args)
+ last =
+ statement.evaluate(**args.merge(object: ::Code::Object::Global.new))
end
last
end
end