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 28 29 30 31 32 |
# File 'lib/active_wrapper/mail.rb', line 6 def initialize() @base = [:base] @config = { :smtp => [:smtp] || {}, :imap => [:imap] || {} } @env = [:env].to_s path = "#{base}/config/mail.yml" if @env == 'test' ActionMailer::Base.delivery_method = :test @config = nil else if File.exists?(path) yaml = YAML::load(File.open(path)) if yaml && yaml = yaml[@env]. @config[:imap] = yaml[:imap]. unless @config[:imap] @config[:smtp] = yaml[:smtp]. unless @config[:smtp] end end if @config[:smtp] ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = @config[:smtp] 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
34 35 36 |
# File 'lib/active_wrapper/mail.rb', line 34 def deliver() Mailer.deliver_email() end |