lib/cutaneous/context.rb in cutaneous-0.1.2 vs lib/cutaneous/context.rb in cutaneous-0.1.3
- old
+ new
@@ -18,11 +18,17 @@
def escape(value)
CGI::escapeHTML(value)
end
def include(template_name, locals = {})
- context = self.dup.__update_with_locals(locals)
+ context = self.clone(locals)
self.__buf << __loader.template(template_name).render(context)
+ end
+
+ def clone(locals = {})
+ context = self.class.new(__target, self)
+ context.__update_with_locals(locals)
+ context
end
def respond_to_missing?(name, include_private = false)
return true if @__locals.key?(name.to_s) || @__locals.key?(name.to_sym)
super