Module: Hanami::Mailer
- Includes:
- Utils::ClassAttribute
- Defined in:
- gems/gems/hanami-1.3.3/lib/hanami/mailer/glue.rb,
gems/gems/hanami-mailer-1.3.1/lib/hanami/mailer/dsl.rb,
gems/gems/hanami-mailer-1.3.1/lib/hanami/mailer/version.rb,
gems/gems/hanami-mailer-1.3.1/lib/hanami/mailer/template.rb,
gems/gems/hanami-mailer-1.3.1/lib/hanami/mailer/configuration.rb,
gems/gems/hanami-mailer-1.3.1/lib/hanami/mailer/rendering/template_name.rb,
gems/gems/hanami-mailer-1.3.1/lib/hanami/mailer/rendering/templates_finder.rb,
gems/gems/hanami-mailer-1.3.1/lib/hanami/mailer.rb,
gems/gems/hanami-mailer-1.3.3/lib/hanami/mailer/dsl.rb,
gems/gems/hanami-mailer-1.3.3/lib/hanami/mailer/version.rb,
gems/gems/hanami-mailer-1.3.3/lib/hanami/mailer/template.rb,
gems/gems/hanami-mailer-1.3.3/lib/hanami/mailer/configuration.rb,
gems/gems/hanami-mailer-1.3.3/lib/hanami/mailer/rendering/template_name.rb,
gems/gems/hanami-mailer-1.3.3/lib/hanami/mailer/rendering/templates_finder.rb,
gems/gems/hanami-mailer-1.3.3/lib/hanami/mailer.rb
Overview
Hanami::Mailer
Defined Under Namespace
Modules: ClassMethods, Dsl Classes: Configuration, Error, MissingDeliveryDataError
Constant Summary
- VERSION =
"1.3.3"
Instance Attribute Summary collapse
- #mail ⇒ Object readonly protected
Class Method Summary collapse
-
.configure(&blk) ⇒ Object
Configure the framework.
-
.deliveries ⇒ Array
Test deliveries.
Instance Method Summary collapse
-
#build ⇒ Object
private
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize.
-
#initialize(locals = {}) ⇒ Object
Initialize a mailer.
-
#prepare ⇒ Object
protected
Prepare the email message when a new mailer is initialized.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object (protected)
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.
Source: | on GitHub
def method_missing(method_name) @locals.fetch(method_name) { super } end |
Instance Attribute Details
Class Method Details
.configure(&blk) ⇒ Object
Configure the framework. It yields the given block in the context of the configuration
Source: | on GitHub
def self.configure(&blk) configuration.instance_eval(&blk) self end |
.deliveries ⇒ Array
Test deliveries
This is a collection of delivered messages, used when delivery_method
is set on :test
Source: | on GitHub
def self.deliveries Mail::TestMailer.deliveries end |
Instance Method Details
#build ⇒ Object (private)
rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize
Source: | on GitHub
def build Mail.new.tap do |m| m.from = __dsl(:from) m.to = __dsl(:to) m.cc = __dsl(:cc) m.bcc = __dsl(:bcc) m.reply_to = __dsl(:reply_to) m.subject = __dsl(:subject) m.charset = charset m.html_part = __part(:html) m.text_part = __part(:txt) m.delivery_method(*Hanami::Mailer.configuration.delivery_method) end end |
#initialize(locals = {}) ⇒ Object
Initialize a mailer
Source: | on GitHub
def initialize(locals = {}) @locals = locals @format = locals.fetch(:format, nil) @charset = locals.fetch(:charset, self.class.configuration.default_charset) @mail = build prepare end |
#prepare ⇒ Object (protected)
Prepare the email message when a new mailer is initialized.
This is a hook that can be overwritten by mailers.
Source: | on GitHub
def prepare end |