lib/sanford/template_engine.rb in sanford-0.19.0 vs lib/sanford/template_engine.rb in sanford-0.19.1
- old
+ new
@@ -15,10 +15,14 @@
def render(name, service_handler, locals)
raise NotImplementedError
end
+ def partial(name, locals)
+ raise NotImplementedError
+ end
+
def ==(other_engine)
if other_engine.kind_of?(TemplateEngine)
self.source_path == other_engine.source_path &&
self.opts == other_engine.opts
else
@@ -29,9 +33,13 @@
end
class NullTemplateEngine < TemplateEngine
def render(template_name, service_handler, locals)
+ self.partial(template_name, locals)
+ end
+
+ def partial(template_name, locals)
paths = Dir.glob(self.source_path.join("#{template_name}*"))
if paths.size > 1
raise ArgumentError, "#{template_name.inspect} matches more than one " \
"file, consider using a more specific template name"
end