Class: Hanami::Mailer::Configuration
- Inherits:
-
Object
- Object
- Hanami::Mailer::Configuration
- Defined in:
- gems/gems/hanami-mailer-1.3.1/lib/hanami/mailer/configuration.rb,
gems/gems/hanami-mailer-1.3.3/lib/hanami/mailer/configuration.rb
Overview
Framework configuration
Instance Attribute Summary collapse
- #default_charset(value = nil) ⇒ Object readonly
-
#delivery_method(method = nil, options = {}) ⇒ Array
readonly
Specify a global delivery method for the mail gateway.
-
#root(value = nil) ⇒ Object
readonly
Set the root path where to search for templates.
Instance Method Summary collapse
-
#initialize ⇒ Hanami::Mailer::Configuration
constructor
Initialize a configuration instance.
-
#load! ⇒ Object
Load the configuration.
-
#prepare(&blk) ⇒ void
Prepare the mailers.
-
#reset! ⇒ Object
(also: #unload!)
Reset the configuration.
Constructor Details
#initialize ⇒ Hanami::Mailer::Configuration
Initialize a configuration instance
Source: | on GitHub
def initialize @namespace = Object reset! end |
Instance Attribute Details
#default_charset(value = nil) ⇒ Object
Source: | on GitHub
def default_charset(value = nil) if value.nil? @default_charset else @default_charset = value end end |
#delivery_method(method = nil, options = {}) ⇒ Array
Specify a global delivery method for the mail gateway.
It supports the following delivery methods:
-
Exim (
:exim
) -
Sendmail (
:sendmail
) -
SMTP (
:smtp
, for local installations) -
SMTP Connection (
:smtp_connection
, viaNet::SMTP
- for remote installations) -
Test (
:test
, for testing purposes)
The default delivery method is SMTP (:smtp
).
Custom delivery methods can be specified by passing the class policy and a set of optional configurations. This class MUST respond to:
-
initialize(options = {})
-
<tt>deliver!(mail)<tt>
Source: | on GitHub
def delivery_method(method = nil, = {}) if method.nil? @delivery_method else @delivery_method = [method, ] end end |
#root(value) ⇒ Object #root ⇒ Pathname
Set the root path where to search for templates
If not set, this value defaults to the current directory.
When this method is called with an argument, it will set the corresponding instance variable. When called without, it will return the already set value, or the default.
Instance Method Details
#load! ⇒ Object
Load the configuration
Source: | on GitHub
def load! mailers.each { |m| m.__send__(:load!) } freeze end |
#prepare(&blk) ⇒ void
This method returns an undefined value.
Prepare the mailers.
The given block will be yielded when Hanami::Mailer
will be included by a mailer.
This method can be called multiple times.
Source: | on GitHub
def prepare(&blk) if block_given? # rubocop:disable Style/GuardClause @modules.push(blk) else raise ArgumentError.new('Please provide a block') end end |