Sha256: fb754a2321e2eb6fe5dbb3cc7d4851e35c3b2aa08ee67cf01f755e414b8a22fd
Contents?: true
Size: 1015 Bytes
Versions: 10
Compression:
Stored size: 1015 Bytes
Contents
=begin MailerWorker has a bit more to do than EventWorker. It has to run the event, then if the output is a Mail::Message or the like it needs to deliver it like ActionMailer would =end module Reactor module Workers class MailerWorker include Reactor::Workers::Configuration def perform(data) raise_unconfigured! unless configured? return :__perform_aborted__ unless should_perform? event = Reactor::Event.new(data) msg = if action.is_a?(Symbol) source.send(action, event) else source.class_exec event, &action end deliverable?(msg) ? deliver(msg) : msg end def deliver(msg) if msg.respond_to?(:deliver_now) # Rails 4.2/5.0 msg.deliver_now else # Rails 3.2/4.0/4.1 + Generic Mail::Message msg.deliver end end def deliverable?(msg) msg.respond_to?(:deliver_now) || msg.respond_to?(:deliver) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems