Class: Dimples::Template

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

Attributes included from Renderable

#rendered_contents

Instance Method Summary collapse

Methods included from Renderable

#render, #rendering_engine, #scope

Methods included from Frontable

#read_with_front_matter

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

#contentsObject

Returns the value of attribute contents.



13
14
15
# File 'lib/dimples/template.rb', line 13

def contents
  @contents
end

#layoutObject

Returns the value of attribute layout.



12
13
14
# File 'lib/dimples/template.rb', line 12

def layout
  @layout
end

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

#slugObject

Returns the value of attribute slug.



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

def slug
  @slug
end

#titleObject

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#inspectObject



23
24
25
# File 'lib/dimples/template.rb', line 23

def inspect
  "#<#{self.class} @slug=#{@slug} @path=#{@path}>"
end