Module: Strelka::App::Templating::ClassMethods
- Defined in:
- lib/strelka/app/templating.rb
Overview
Class methods to add to classes with templating.
Instance Attribute Summary collapse
-
#layout_template ⇒ Object
Returns the value of attribute layout_template.
-
#template_map ⇒ Object
readonly
Returns the value of attribute template_map.
Instance Method Summary collapse
-
#inherited(subclass) ⇒ Object
Extension callback – add instance variables to extending objects.
-
#layout(tmplpath = nil) ⇒ Object
Declare a template that will act as a wrapper for all other templates.
-
#templates(newhash = nil) ⇒ Object
Get/set the templates declared for the App.
Instance Attribute Details
#layout_template ⇒ Object
Returns the value of attribute layout_template.
162 163 164 |
# File 'lib/strelka/app/templating.rb', line 162 def layout_template @layout_template end |
#template_map ⇒ Object (readonly)
Returns the value of attribute template_map.
159 160 161 |
# File 'lib/strelka/app/templating.rb', line 159 def template_map @template_map end |
Instance Method Details
#inherited(subclass) ⇒ Object
Extension callback – add instance variables to extending objects.
166 167 168 169 170 |
# File 'lib/strelka/app/templating.rb', line 166 def inherited( subclass ) super subclass.instance_variable_set( :@template_map, @template_map.dup ) subclass.instance_variable_set( :@layout_template, @layout_template.dup ) if @layout_template end |
#layout(tmplpath = nil) ⇒ Object
Declare a template that will act as a wrapper for all other templates
184 185 186 187 |
# File 'lib/strelka/app/templating.rb', line 184 def layout( tmplpath=nil ) self.layout_template = tmplpath if tmplpath return self.layout_template end |
#templates(newhash = nil) ⇒ Object
Get/set the templates declared for the App.
174 175 176 177 178 179 180 |
# File 'lib/strelka/app/templating.rb', line 174 def templates( newhash=nil ) if newhash self.template_map.merge!( newhash ) end return self.template_map end |