Class: SitemapGenerator::Templates
- Inherits:
-
Object
- Object
- SitemapGenerator::Templates
- 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
-
#initialize(root = SitemapGenerator.root) ⇒ Templates
constructor
A new instance of Templates.
-
#template_path(template) ⇒ Object
Return the full path to a template.
Constructor Details
#initialize(root = SitemapGenerator.root) ⇒ Templates
Returns a new instance of Templates.
26 27 28 |
# File 'lib/sitemap_generator/templates.rb', line 26 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
33 34 35 |
# File 'lib/sitemap_generator/templates.rb', line 33 def template_path(template) File.join(@root, 'templates', self.class::FILES[template]) end |