Module: Caffeinate::Dripper::Delivery::ClassMethods

Defined in:
lib/caffeinate/dripper/delivery.rb

Instance Method Summary collapse

Instance Method Details

#deliver!(mailing) ⇒ Object

Delivers the given Caffeinate::Mailing

Parameters:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/caffeinate/dripper/delivery.rb', line 16

def deliver!(mailing)
  message = if mailing.drip.parameterized?
              mailing.mailer_class.constantize.with(mailing: mailing).send(mailing.mailer_action)
            else
              mailing.mailer_class.constantize.send(mailing.mailer_action, mailing)
            end

  message.caffeinate_mailing = mailing
  if ::Caffeinate.config.deliver_later?
    message.deliver_later
  else
    message.deliver
  end

end