blob: e5868ab43bf24ad1cce62bd6e2401570d1ef5f0d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
require 'delegate'
module ActionMailer
class QueuedMessage < ::Delegator
attr_reader :queue
def initialize(queue, mailer_class, method_name, *args)
@queue = queue
@mailer_class = mailer_class
@method_name = method_name
@args = args
end
def __getobj__
@actual_message ||= @mailer_class.send(:new, @method_name, *@args).message
end
def run
__getobj__.deliver
end
# Will push the message onto the Queue to be processed
def deliver
@queue << self
end
end
end
|