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
458 def create_template(opts, template_opts)
459   opts[:template_class].new(opts[:path], 1, template_opts, &opts[:template_block])
460 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
443 def freeze
444   begin
445     _freeze_layout_method
446   rescue
447     # This is only for optimization, if any errors occur, they can be ignored.
448     # One possibility for error is the app doesn't use a layout, but doesn't
449     # specifically set the :layout=>false plugin option.
450     nil
451   end
452 
453   super
454 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
471 def inherited(subclass)
472   super
473   opts = subclass.opts[:render] = subclass.opts[:render].dup
474   if COMPILED_METHOD_SUPPORT
475     opts[:template_method_cache] = (opts[:cache_class] || RodaCache).new
476   end
477   opts[:cache] = opts[:cache].dup
478   opts.freeze
479 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
464 def inline_template_block(content)
465   Proc.new{content}
466 end
render_opts()

Return the render options for this class.

[show source]
    # File lib/roda/plugins/render.rb
482 def render_opts
483   opts[:render]
484 end