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.
12 13 14 |
# File 'lib/hanami/mailer/template.rb', line 12 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
35 36 37 |
# File 'lib/hanami/mailer/template.rb', line 35 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.
25 26 27 |
# File 'lib/hanami/mailer/template.rb', line 25 def render(scope = Object.new, locals = {}) @_template.render(scope, locals) end |