Class: Dimples::Template

Inherits:
Object
  • Object
show all
Includes:
Frontable, Renderable
Defined in:
lib/dimples/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Renderable

#build_scope, #render, #renderer

Methods included from Frontable

#apply_metadata, #read_with_yaml

Constructor Details

#initialize(site, path) ⇒ Template

Returns a new instance of Template.



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

def initialize(site, path)
  @site = site
  @slug = File.basename(path, File.extname(path))
  @path = path

  @contents = read_with_yaml(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

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

#rendered_contentsObject

Returns the value of attribute rendered_contents.



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

def rendered_contents
  @rendered_contents
end

#slugObject

Returns the value of attribute slug.



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

def slug
  @slug
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end