Sha256: 41a8c4d1ba515a4bd46f6f10c62fbcfa2c53af48aae10fbaac75fca66d651424
Contents?: true
Size: 644 Bytes
Versions: 19
Compression:
Stored size: 644 Bytes
Contents
module Rasti module Web class Template 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
Version data entries
19 entries across 19 versions & 1 rubygems