lib/rasti/web/template.rb in rasti-web-2.0.1 vs lib/rasti/web/template.rb in rasti-web-2.1.0
- old
+ new
@@ -5,19 +5,19 @@
def self.render(template, context=nil, locals={}, &block)
files = Web.template_engines.map { |e| File.join Web.views_path, "#{template}.#{e}" }
template_file = files.detect { |f| File.exists? f }
raise "Missing template #{template} [#{files.join(', ')}]" unless template_file
-
+
tilt = cache.fetch(template_file) { Tilt.new template_file }
tilt.render(context, locals, &block)
end
private
def self.cache
Thread.current[:templates_cache] ||= Tilt::Cache.new
end
-
+
end
end
end
\ No newline at end of file