Class: Memorable::TemplateEngine
- Inherits:
-
Object
- Object
- Memorable::TemplateEngine
- Includes:
- Singleton
- Defined in:
- lib/memorable/template_engine.rb
Overview
This is an abstract class, do not use it directly. Inherit from this class and implement custom load!/parse/render medthods.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#load_path ⇒ Object
readonly
Instance Methods ————————–.
-
#templates ⇒ Object
readonly
Instance Methods ————————–.
Class Method Summary collapse
- .assemble(*args) ⇒ Object
-
.load! ⇒ Object
Class Methods ————————– Override this method in subclass.
Instance Method Summary collapse
- #assemble(options) ⇒ Object
-
#initialize ⇒ TemplateEngine
constructor
A new instance of TemplateEngine.
-
#parse(controller, action, sub_key) ⇒ Object
Override this method in subclass.
Constructor Details
#initialize ⇒ TemplateEngine
Returns a new instance of TemplateEngine.
25 26 27 28 |
# File 'lib/memorable/template_engine.rb', line 25 def initialize @load_path = [] @templates = {} end |
Instance Attribute Details
#load_path ⇒ Object (readonly)
Instance Methods
23 24 25 |
# File 'lib/memorable/template_engine.rb', line 23 def load_path @load_path end |
#templates ⇒ Object (readonly)
Instance Methods
23 24 25 |
# File 'lib/memorable/template_engine.rb', line 23 def templates @templates end |
Class Method Details
.assemble(*args) ⇒ Object
16 17 18 |
# File 'lib/memorable/template_engine.rb', line 16 def self.assemble(*args) instance.assemble(*args) end |
.load! ⇒ Object
Class Methods
Override this method in subclass
13 14 |
# File 'lib/memorable/template_engine.rb', line 13 def self.load! end |
Instance Method Details
#assemble(options) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/memorable/template_engine.rb', line 30 def assemble() parse([:controller], [:action], [:template_key]).map do |locale, template| content = render(template, ) [locale, content] end end |
#parse(controller, action, sub_key) ⇒ Object
Override this method in subclass
38 39 |
# File 'lib/memorable/template_engine.rb', line 38 def parse(controller, action, sub_key) end |