Class: Dimples::Template

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from Frontable

#read_with_front_matter

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

#contentsObject

Returns the value of attribute contents.



9
10
11
# File 'lib/dimples/template.rb', line 9

def contents
  @contents
end

#metadataObject

Returns the value of attribute metadata.



10
11
12
# File 'lib/dimples/template.rb', line 10

def 
  
end

#pathObject

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