Module: MailRotator::Switcher

Defined in:
lib/mail_rotator/switcher.rb

Class Method Summary collapse

Class Method Details

.treat(klass) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/mail_rotator/switcher.rb', line 7

def treat(klass)
  validate_constant
  validate_rows

  mailer = current_mailer
  mailer.public_send(mailer.over_limit? ? :reset : :increment)

  assign_mailer(klass, current_mailer)
end

.validate_constantObject



17
18
19
20
# File 'lib/mail_rotator/switcher.rb', line 17

def validate_constant
  return if Switcher.const_defined?("SMTP_SETTINGS")
  raise "MailRotator: MailRotator::Switcher::SMTP_SETTINGS is not defined. Refer to the README."
end