Class: Reactor::Workers::MailerWorker
- Inherits:
-
Object
- Object
- Reactor::Workers::MailerWorker
show all
- Includes:
- Configuration
- Defined in:
- lib/reactor/workers/mailer_worker.rb
Constant Summary
Configuration::CONFIG
Instance Method Summary
collapse
#configured?, #should_perform?
Instance Method Details
#deliver(msg) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/reactor/workers/mailer_worker.rb', line 25
def deliver(msg)
if msg.respond_to?(:deliver_now)
msg.deliver_now
else
msg.deliver
end
end
|
#deliverable?(msg) ⇒ Boolean
35
36
37
|
# File 'lib/reactor/workers/mailer_worker.rb', line 35
def deliverable?(msg)
msg.respond_to?(:deliver_now) || msg.respond_to?(:deliver)
end
|
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/reactor/workers/mailer_worker.rb', line 11
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
|