Class: ActiveWrapper::Mail
- Inherits:
-
Object
- Object
- ActiveWrapper::Mail
- Defined in:
- lib/active_wrapper/mail.rb
Defined Under Namespace
Classes: Mailer
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #deliver(options) ⇒ Object
-
#initialize(options) ⇒ Mail
constructor
A new instance of Mail.
Constructor Details
#initialize(options) ⇒ Mail
Returns a new instance of Mail.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/active_wrapper/mail.rb', line 6 def initialize() @base = [:base] @env = [:env].to_s path = "#{base}/config/mail.yml" if @env == 'test' ActionMailer::Base.delivery_method = :test elsif File.exists?(path) @config = YAML::load(File.open(path)) if @config && @config = @config[@env] @config = @config. @config[:imap] = @config[:imap]. if @config[:imap] @config[:smtp] = @config[:smtp]. if @config[:smtp] if @config[:smtp] ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = @config[:smtp] end end end end |
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
4 5 6 |
# File 'lib/active_wrapper/mail.rb', line 4 def base @base end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/active_wrapper/mail.rb', line 4 def config @config end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
4 5 6 |
# File 'lib/active_wrapper/mail.rb', line 4 def env @env end |
Instance Method Details
#deliver(options) ⇒ Object
29 30 31 |
# File 'lib/active_wrapper/mail.rb', line 29 def deliver() Mailer.deliver_email() end |