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
539 def create_template(opts, template_opts)
540   opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block])
541 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
524 def freeze
525   begin
526     _freeze_layout_method
527   rescue
528     # This is only for optimization, if any errors occur, they can be ignored.
529     # One possibility for error is the app doesn't use a layout, but doesn't
530     # specifically set the :layout=>false plugin option.
531     nil
532   end
533 
534   super
535 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
552 def inherited(subclass)
553   super
554   opts = subclass.opts[:render] = subclass.opts[:render].dup
555   if COMPILED_METHOD_SUPPORT
556     opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new
557   end
558   opts[:cache] = opts[:cache].dup
559   opts.freeze
560 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
545 def inline_template_block(content)
546   Proc.new{content}
547 end
render_opts()

Return the render options for this class.

[show source]
    # File lib/roda/plugins/render.rb
563 def render_opts
564   opts[:render]
565 end