Class: Dimples::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/dimples/template.rb

Overview

A single template used when rendering pages, posts and other templates.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site, path) ⇒ Template

Returns a new instance of Template.



10
11
12
13
14
15
16
# File 'lib/dimples/template.rb', line 10

def initialize(site, path)
  @site = site
  @path = path

  data = File.read(path)
  @contents,  = FrontMatter.parse(data)
end

Instance Attribute Details

#contentsObject

Returns the value of attribute contents.



7
8
9
# File 'lib/dimples/template.rb', line 7

def contents
  @contents
end

#metadataObject

Returns the value of attribute metadata.



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

def 
  
end

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/dimples/template.rb', line 6

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