def initialize backend, template_dirs, opts = {}
Helpers.require_library 'tilt' unless defined? ::Tilt
@backend = backend
@templates = {}
@template_dirs = template_dirs
@eruby = opts[:eruby]
@safe = opts[:safe]
@engine = opts[:template_engine]
@engine_options = DEFAULT_ENGINE_OPTIONS.inject({}) do |accum, (engine, default_opts)|
accum[engine] = default_opts.dup
accum
end
if opts[:htmlsyntax] == 'html'
@engine_options[:haml][:format] = :html5
@engine_options[:slim][:format] = :html
end
if (overrides = opts[:template_engine_options])
overrides.each do |engine, override_opts|
(@engine_options[engine] ||= {}).update override_opts
end
end
case opts[:template_cache]
when true
@caches = self.class.caches
when ::Hash
@caches = opts[:template_cache]
else
@caches = {}
end
scan
end