Class: Mail::LoggerDelivery

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CheckDeliveryParams

check, check_addr, check_from, check_message, check_to, validate_smtp_addr

Constructor Details

#initialize(settings) ⇒ LoggerDelivery

Returns a new instance of LoggerDelivery.


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

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


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

def logger
  @logger
end

#settingsObject (readonly)

Returns the value of attribute settings


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

def settings
  @settings
end

#severityObject (readonly)

Returns the value of attribute severity


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

def severity
  @severity
end

Instance Method Details

#deliver!(mail) ⇒ Object


15
16
17
18
# File 'lib/mail/network/delivery_methods/logger_delivery.rb', line 15

def deliver!(mail)
  Mail::CheckDeliveryParams.check(mail)
  logger.log(severity) { mail.encoded }
end