Class: Dimples::Template
- Inherits:
-
Object
- Object
- Dimples::Template
- Includes:
- Frontable
- Defined in:
- lib/dimples/template.rb
Overview
A single template used when rendering pages, posts and other templates.
Constant Summary
Constants included from Frontable
Frontable::FRONT_MATTER_PATTERN
Instance Attribute Summary collapse
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(site, path) ⇒ Template
constructor
A new instance of Template.
- #render(context = {}, body = nil) ⇒ Object
Methods included from Frontable
Constructor Details
#initialize(site, path) ⇒ Template
Returns a new instance of Template.
12 13 14 15 16 |
# File 'lib/dimples/template.rb', line 12 def initialize(site, path) @site = site @path = path @contents, = read_with_front_matter(path) end |
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
9 10 11 |
# File 'lib/dimples/template.rb', line 9 def contents @contents end |
#metadata ⇒ Object
Returns the value of attribute metadata.
10 11 12 |
# File 'lib/dimples/template.rb', line 10 def end |
#path ⇒ Object
Returns the value of attribute path.
8 9 10 |
# File 'lib/dimples/template.rb', line 8 def path @path end |
Instance Method Details
#render(context = {}, body = nil) ⇒ Object
18 19 20 21 |
# File 'lib/dimples/template.rb', line 18 def render(context = {}, body = nil) context[:template] ||= Hashie::Mash.new() renderer.render(context, body) end |