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
445 def create_template(opts, template_opts)
446   opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block])
447 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
430 def freeze
431   begin
432     _freeze_layout_method
433   rescue
434     # This is only for optimization, if any errors occur, they can be ignored.
435     # One possibility for error is the app doesn't use a layout, but doesn't
436     # specifically set the :layout=>false plugin option.
437     nil
438   end
439 
440   super
441 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
458 def inherited(subclass)
459   super
460   opts = subclass.opts[:render] = subclass.opts[:render].dup
461   if COMPILED_METHOD_SUPPORT
462     opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new
463   end
464   opts[:cache] = opts[:cache].dup
465   opts.freeze
466 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
451 def inline_template_block(content)
452   Proc.new{content}
453 end
render_opts()

Return the render options for this class.

[show source]
    # File lib/roda/plugins/render.rb
469 def render_opts
470   opts[:render]
471 end