class Hanami::Mailer::Template
A logic-less template.
@api private @since 0.1.0
TODO this is identical to Hanami::View, consider to move into Hanami::Utils
Public Class Methods
new(template, encoding = Encoding::UTF_8)
click to toggle source
# File lib/hanami/mailer/template.rb, line 14 def initialize(template, encoding = Encoding::UTF_8) @_template = Tilt.new(template, default_encoding: encoding) end
Public Instance Methods
file()
click to toggle source
Get the path to the template
@return [String] the pathname
@api private @since 0.1.0
# File lib/hanami/mailer/template.rb, line 37 def file @_template.file end
render(scope = Object.new, locals = {})
click to toggle source
Render the template within the context of the given scope.
@param scope [Class] the rendering scope @param locals [Hash] set of objects passed to the constructor
@return [String] the output of the rendering process
@api private @since 0.1.0
# File lib/hanami/mailer/template.rb, line 27 def render(scope = Object.new, locals = {}) @_template.render(scope, locals) end