Class: SitemapGenerator::Templates

Inherits:
Object
  • Object
show all
Defined in:
lib/sitemap_generator/templates.rb

Overview

Provide convenient access to template files. E.g.

SitemapGenerator.templates.sitemap_index

Lazy-load and cache for efficient access. Define an accessor method for each template file.

Constant Summary collapse

FILES =
{
  :sitemap_sample =>  'sitemap.rb',
}

Instance Method Summary collapse

Constructor Details

#initialize(root = SitemapGenerator.root) ⇒ Templates

Returns a new instance of Templates.



23
24
25
# File 'lib/sitemap_generator/templates.rb', line 23

def initialize(root = SitemapGenerator.root)
  @root = root
end

Instance Method Details

#template_path(template) ⇒ Object

Return the full path to a template.

file template symbol e.g. :sitemap_sample



30
31
32
# File 'lib/sitemap_generator/templates.rb', line 30

def template_path(template)
  File.join(@root, 'templates', self.class::FILES[template])
end