module Roda::RodaPlugins::Render::ClassMethods

  1. lib/roda/plugins/render.rb

Public Instance methods

create_template(opts, template_opts)

Return an Tilt::Template object based on the given opts and template_opts.

[show source]
    # File lib/roda/plugins/render.rb
556 def create_template(opts, template_opts)
557   opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block])
558 end
freeze()

If using compiled methods and there is an optimized layout, speed up access to the layout method to improve the performance of view.

[show source]
    # File lib/roda/plugins/render.rb
535 def freeze
536   begin
537     _freeze_layout_method
538   rescue
539     # This is only for optimization, if any errors occur, they can be ignored.
540     # One possibility for error is the app doesn't use a layout, but doesn't
541     # specifically set the :layout=>false plugin option.
542     nil
543   end
544 
545   # Optimize _call_optimized_template_method if you know all templates
546   # are going to be using fixed locals.
547   if render_opts[:assume_fixed_locals] && !render_opts[:check_template_mtime]
548     include AssumeFixedLocalsInstanceMethods
549   end
550 
551   super
552 end
inherited(subclass)

Copy the rendering options into the subclass, duping them as necessary to prevent changes in the subclass affecting the parent class.

[show source]
    # File lib/roda/plugins/render.rb
569 def inherited(subclass)
570   super
571   opts = subclass.opts[:render] = subclass.opts[:render].dup
572   if COMPILED_METHOD_SUPPORT
573     opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new
574   end
575   opts[:cache] = opts[:cache].dup
576   opts.freeze
577 end
inline_template_block(content)

A proc that returns content, used for inline templates, so that the template doesn’t hold a reference to the instance of the class

[show source]
    # File lib/roda/plugins/render.rb
562 def inline_template_block(content)
563   Proc.new{content}
564 end
render_opts()

Return the render options for this class.

[show source]
    # File lib/roda/plugins/render.rb
580 def render_opts
581   opts[:render]
582 end