Class: Mail::LoggerDelivery

Inherits:
Object
  • Object
show all
Defined in:
lib/mail/network/delivery_methods/logger_delivery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(settings) ⇒ LoggerDelivery

Returns a new instance of LoggerDelivery.


7
8
9
10
11
# File 'lib/mail/network/delivery_methods/logger_delivery.rb', line 7

def initialize(settings)
  @settings = settings
  @logger   = settings.fetch(:logger) { default_logger }
  @severity = derive_severity(settings[:severity])
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger


5
6
7
# File 'lib/mail/network/delivery_methods/logger_delivery.rb', line 5

def logger
  @logger
end

#settingsObject (readonly)

Returns the value of attribute settings


5
6
7
# File 'lib/mail/network/delivery_methods/logger_delivery.rb', line 5

def settings
  @settings
end

#severityObject (readonly)

Returns the value of attribute severity


5
6
7
# File 'lib/mail/network/delivery_methods/logger_delivery.rb', line 5

def severity
  @severity
end

Instance Method Details

#deliver!(mail) ⇒ Object


13
14
15
# File 'lib/mail/network/delivery_methods/logger_delivery.rb', line 13

def deliver!(mail)
  logger.log(severity) { Mail::SmtpEnvelope.new(mail).message }
end