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
441 def create_template(opts, template_opts)
442   opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block])
443 end

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
426 def freeze
427   begin
428     _freeze_layout_method
429   rescue
430     # This is only for optimization, if any errors occur, they can be ignored.
431     # One possibility for error is the app doesn't use a layout, but doesn't
432     # specifically set the :layout=>false plugin option.
433     nil
434   end
436   super
437 end

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
454 def inherited(subclass)
455   super
456   opts = subclass.opts[:render] = subclass.opts[:render].dup
458     opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new
459   end
460   opts[:cache] = opts[:cache].dup
461   opts.freeze
462 end

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
447 def inline_template_block(content)
449 end

Return the render options for this class.

[show source]
    # File lib/roda/plugins/render.rb
465 def render_opts
466   opts[:render]
467 end