lib/wlang/template.rb in wlang-2.0.1 vs lib/wlang/template.rb in wlang-2.1.0
- old
+ new
@@ -42,12 +42,12 @@
def to_ast
compiler.to_ast(template_content)
end
- def call(locs = {}, buffer = '')
- scope = WLang::Scope.chain([locals, locs])
+ def call(*args)
+ scope, buffer = call_args_conventions(args)
dialect_instance.dup.render compiled, scope, buffer
end
alias :render :call
private
@@ -55,9 +55,17 @@
attr_reader :source, :compiled, :dialect_instance
def yaml_front_matter?
opt = options[:yaml_front_matter]
opt.nil? or opt
+ end
+
+ def call_args_conventions(args)
+ args << '' unless args.last.respond_to?(:<<)
+ buffer = args.pop
+ args << self.locals unless self.locals.empty?
+ scope = WLang::Scope.chain(args)
+ [scope, buffer]
end
end # class Template
end # module WLang