lib/mattock/template-host.rb in mattock-0.2.13 vs lib/mattock/template-host.rb in mattock-0.3.0

- old
+ new

@@ -24,16 +24,17 @@ break end end if base_path.empty? - raise "Relative root #{up_to} not found in #{abs_path}" + raise "Relative root #{up_to.inspect} not found in #{abs_path.inspect}" end return base_path end module_function :rel_dir, :default_valise + public :rel_dir, :default_valise end module TemplateHost def self.template_cache @template_cache ||= Tilt::Cache.new @@ -58,10 +59,15 @@ Tilt.new(path, template_options || {}) do |tmpl| template_contents(tmpl.file) end end - template.render(self) + locals = {} + if block_given? + yield locals + end + + template.render(self, locals) end end module TemplateTaskLib include TemplateHost