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
568 def create_template(opts, template_opts)
569   opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block])
570 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
547 def freeze
548   begin
549     _freeze_layout_method
550   rescue
551     # This is only for optimization, if any errors occur, they can be ignored.
552     # One possibility for error is the app doesn't use a layout, but doesn't
553     # specifically set the :layout=>false plugin option.
554     nil
555   end
556 
557   # Optimize _call_optimized_template_method if you know all templates
558   # are going to be using fixed locals.
559   if render_opts[:assume_fixed_locals] && !render_opts[:check_template_mtime]
560     include AssumeFixedLocalsInstanceMethods
561   end
562 
563   super
564 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
581 def inherited(subclass)
582   super
583   opts = subclass.opts[:render] = subclass.opts[:render].dup
584   if COMPILED_METHOD_SUPPORT
585     opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new
586   end
587   opts[:cache] = opts[:cache].dup
588   opts.freeze
589 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
574 def inline_template_block(content)
575   Proc.new{content}
576 end
render_opts()

Return the render options for this class.

[show source]
    # File lib/roda/plugins/render.rb
592 def render_opts
593   opts[:render]
594 end