Class: Hanami::Mailer::Template Private
- Inherits:
-
Object
- Object
- Hanami::Mailer::Template
- Defined in:
- lib/hanami/mailer/template.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A logic-less template.
TODO this is identical to Hanami::View, consider to move into Hanami::Utils
Instance Method Summary collapse
-
#file ⇒ String
private
Get the path to the template.
-
#initialize(template, encoding = Encoding::UTF_8) ⇒ Template
constructor
private
A new instance of Template.
-
#render(scope = Object.new, locals = {}) ⇒ String
private
Render the template within the context of the given scope.
Constructor Details
#initialize(template, encoding = Encoding::UTF_8) ⇒ Template
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Template.
14 15 16 |
# File 'lib/hanami/mailer/template.rb', line 14 def initialize(template, encoding = Encoding::UTF_8) @_template = Tilt.new(template, default_encoding: encoding) end |
Instance Method Details
#file ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the path to the template
37 38 39 |
# File 'lib/hanami/mailer/template.rb', line 37 def file @_template.file end |
#render(scope = Object.new, locals = {}) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Render the template within the context of the given scope.
27 28 29 |
# File 'lib/hanami/mailer/template.rb', line 27 def render(scope = Object.new, locals = {}) @_template.render(scope, locals) end |