Class: Dimples::Template
- Inherits:
-
Object
- Object
- Dimples::Template
- Includes:
- Frontable, Renderable
- Defined in:
- lib/dimples/template.rb
Overview
A class that models a single template.
Constant Summary
Constants included from Frontable
Frontable::SKIPPED_METADATA_KEYS
Instance Attribute Summary collapse
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#layout ⇒ Object
Returns the value of attribute layout.
-
#path ⇒ Object
Returns the value of attribute path.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes included from Renderable
Instance Method Summary collapse
-
#initialize(site, path) ⇒ Template
constructor
A new instance of Template.
- #inspect ⇒ Object
Methods included from Renderable
#render, #rendering_engine, #scope
Methods included from Frontable
Constructor Details
#initialize(site, path) ⇒ Template
Returns a new instance of Template.
15 16 17 18 19 20 21 |
# File 'lib/dimples/template.rb', line 15 def initialize(site, path) @site = site @slug = File.basename(path, File.extname(path)) @path = path read_with_front_matter end |
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
13 14 15 |
# File 'lib/dimples/template.rb', line 13 def contents @contents end |
#layout ⇒ Object
Returns the value of attribute layout.
12 13 14 |
# File 'lib/dimples/template.rb', line 12 def layout @layout end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/dimples/template.rb', line 9 def path @path end |
#slug ⇒ Object
Returns the value of attribute slug.
11 12 13 |
# File 'lib/dimples/template.rb', line 11 def slug @slug end |
#title ⇒ Object
Returns the value of attribute title.
10 11 12 |
# File 'lib/dimples/template.rb', line 10 def title @title end |
Instance Method Details
#inspect ⇒ Object
23 24 25 |
# File 'lib/dimples/template.rb', line 23 def inspect "#<#{self.class} @slug=#{@slug} @path=#{@path}>" end |