Class: Alephant::Renderer::Engine::Mustache
- Inherits:
-
Object
- Object
- Alephant::Renderer::Engine::Mustache
- Defined in:
- lib/alephant/renderer/engine/mustache.rb
Instance Method Summary collapse
- #default_shared_partial_path ⇒ Object
-
#initialize(base_path, namespace, partials_path = nil) ⇒ Mustache
constructor
A new instance of Mustache.
- #render(data) ⇒ Object
- #template_path ⇒ Object
Constructor Details
#initialize(base_path, namespace, partials_path = nil) ⇒ Mustache
Returns a new instance of Mustache.
7 8 9 10 11 |
# File 'lib/alephant/renderer/engine/mustache.rb', line 7 def initialize(base_path, namespace, partials_path = nil) @namespace = namespace @base_path = base_path @partial_path = partials_path || default_shared_partial_path end |
Instance Method Details
#default_shared_partial_path ⇒ Object
18 19 20 |
# File 'lib/alephant/renderer/engine/mustache.rb', line 18 def default_shared_partial_path File.join(@base_path, '../lib/templates') end |
#render(data) ⇒ Object
13 14 15 16 |
# File 'lib/alephant/renderer/engine/mustache.rb', line 13 def render(data) mustache.template_path = @partial_path mustache.render(template, data) end |
#template_path ⇒ Object
22 23 24 |
# File 'lib/alephant/renderer/engine/mustache.rb', line 22 def template_path File.join(@base_path, 'templates') end |