Class: Souffle::Template
- Inherits:
-
Object
- Object
- Souffle::Template
- Defined in:
- lib/souffle/template.rb
Overview
Template wrapper around the Tilt Template Abstraction Library.
Class Method Summary collapse
-
.template_path ⇒ String
Helper pointing to the default templates path.
Instance Method Summary collapse
-
#initialize(template) ⇒ Template
constructor
Creates a new template.
-
#render(binding) ⇒ String
Renders the template with the given binding.
Constructor Details
#initialize(template) ⇒ Template
Creates a new template.
10 11 12 13 |
# File 'lib/souffle/template.rb', line 10 def initialize(template) @template = Tilt.new( File.("#{Souffle::Template.template_path}/#{template}")) end |
Class Method Details
.template_path ⇒ String
Helper pointing to the default templates path.
27 28 29 |
# File 'lib/souffle/template.rb', line 27 def self.template_path File.(File.join(File.dirname(__FILE__), 'templates')) end |
Instance Method Details
#render(binding) ⇒ String
Renders the template with the given binding.
20 21 22 |
# File 'lib/souffle/template.rb', line 20 def render(binding) @template.render(binding) end |