module Roda::RodaPlugins::Render
def self.configure(app, opts=OPTS)
def self.configure(app, opts=OPTS) if app.opts[:render] app.opts[:render].merge!(opts) else app.opts[:render] = opts.dup end opts = app.opts[:render] opts[:engine] ||= "erb" opts[:ext] = nil unless opts.has_key?(:ext) opts[:views] ||= File.expand_path("views", Dir.pwd) opts[:layout] = "layout" unless opts.has_key?(:layout) opts[:layout_opts] ||= (opts[:layout_opts] || {}).dup if layout = opts[:layout] layout = {:template=>layout} unless layout.is_a?(Hash) opts[:layout_opts] = opts[:layout_opts].merge(layout) end opts[:opts] ||= (opts[:opts] || {}).dup opts[:opts][:outvar] ||= '@_out_buf' if RUBY_VERSION >= "1.9" && !opts[:opts].has_key?(:default_encoding) opts[:opts][:default_encoding] = Encoding.default_external end if opts[:escape] opts[:opts][:engine_class] = ErubisEscaping::Eruby end opts[:cache] = app.thread_safe_cache if opts.fetch(:cache, ENV['RACK_ENV'] != 'development') end
def self.load_dependencies(app, opts=OPTS)
def self.load_dependencies(app, opts=OPTS) if opts[:escape] app.plugin :_erubis_escaping end end