lib/lbrt/utils.rb in lbrt-0.1.5 vs lib/lbrt/utils.rb in lbrt-0.1.6

- old
+ new

@@ -38,17 +38,20 @@ @context.templates[name.to_s] = block end end module TemplateHelper - def include_template(template_name) + def include_template(template_name, context = {}) tmplt = @context.templates[template_name.to_s] unless tmplt raise "Template `#{template_name}` is not defined" end + context_orig = @context + @context = @context.merge(context) instance_eval(&tmplt) + @context = context_orig end end module CLIHelper REGEXP_OPTIONS = [