module Roda::RodaPlugins::Inversion::ClassMethods
Attributes
layout_template[RW]
An optional layout/wrap template.
template_map[R]
The map of template names to template file paths.
Public Class Methods
extended( subclass )
click to toggle source
Add this Gem’s template location to the Inversion
search path.
Calls superclass method
# File lib/roda/plugins/inversion.rb, line 104 def self::extended( subclass ) subclass.instance_variable_set( :@template_map, {} ) subclass.instance_variable_set( :@layout_template, nil ) super end
Public Instance Methods
layout( tmpl )
click to toggle source
Load an Inversion::Template
for the layout template.
# File lib/roda/plugins/inversion.rb, line 133 def layout( tmpl ) enc = Encoding.default_internal || Encoding::UTF_8 self.layout_template = ::Inversion::Template.load( tmpl, encoding: enc ) return self.layout_template end
templates( hash )
click to toggle source
Load instances for all the template paths specified in the App’s class and return them in a hash keyed by name (Symbol).
# File lib/roda/plugins/inversion.rb, line 121 def templates( hash ) @template_map = hash.each_with_object( {} ) do |(name, path), map| enc = Encoding.default_internal || Encoding::UTF_8 map[ name ] = ::Inversion::Template.load( path, encoding: enc ) map end return self.template_map end