module Roda::RodaPlugins::Render::ClassMethods
def _freeze_layout_method
def _freeze_layout_method if render_opts[:layout] instance = allocate instance.send(:retrieve_template, instance.send(:view_layout_opts, OPTS)) if COMPILED_METHOD_SUPPORT if (layout_template = render_opts[:optimize_layout]) && !opts[:render][:optimized_layout_method_created] instance.send(:retrieve_template, :template=>layout_template, :cache_key=>nil, :template_method_cache_key => :_roda_layout) layout_method = opts[:render][:template_method_cache][:_roda_layout] define_method(:_layout_method){layout_method} private :_layout_method alias_method(:_layout_method, :_layout_method) opts[:render] = opts[:render].merge(:optimized_layout_method_created=>true) end end end end
def create_template(opts, template_opts)
def create_template(opts, template_opts) opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block]) end
def freeze
If using compiled methods and there is an optimized layout, speed up
def freeze begin _freeze_layout_method rescue # This is only for optimization, if any errors occur, they can be ignored. # One possibility for error is the app doesn't use a layout, but doesn't # specifically set the :layout=>false plugin option. nil end super end
def inherited(subclass)
them as necessary to prevent changes in the subclass
Copy the rendering options into the subclass, duping
def inherited(subclass) super opts = subclass.opts[:render] = subclass.opts[:render].dup if COMPILED_METHOD_SUPPORT opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new end opts[:cache] = opts[:cache].dup opts.freeze end
def inline_template_block(content)
A proc that returns content, used for inline templates, so that the template
def inline_template_block(content) Proc.new{content} end
def render_opts
def render_opts opts[:render] end