From 67dd2aa4d59b40b86c435d1ab5f620d3db012b90 Mon Sep 17 00:00:00 2001 From: Stormwind Date: Thu, 29 Nov 2012 21:25:50 +0100 Subject: Throws ArgumentError, if given template does not exist --- lib/zero/renderer.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/zero/renderer.rb b/lib/zero/renderer.rb index 5bbb875..54d2d29 100644 --- a/lib/zero/renderer.rb +++ b/lib/zero/renderer.rb @@ -121,11 +121,13 @@ module Zero # @param types [Array] the types for the template # @return [Tilt::Template] a prepared tilt template def template(name, types) - types.each do |type| - template = templates[name][type] - unless template.nil? - return template if template.kind_of?(Tilt::Template) - return Tilt.new(template) + if templates.has_key? name + types.each do |type| + template = templates[name][type] + unless template.nil? + return template if template.kind_of?(Tilt::Template) + return Tilt.new(template) + end end end raise ArgumentError.new "No template found for '#{name}'!" -- cgit v1.2.3-70-g09d2