delayed_job_extras 0.9.11 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/delayed_job_extras/action_mailer.rb +32 -29
- metadata +1 -1
@@ -2,51 +2,54 @@ if defined?(ActionMailer)
|
|
2
2
|
module ActionMailer
|
3
3
|
class Base
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def inherited(klass)
|
8
|
+
super
|
9
|
+
eval %{
|
10
|
+
class ::#{klass}Worker < DJ::Worker
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
+
attr_accessor :called_method
|
13
|
+
attr_accessor :args
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
def initialize(called_method, *args)
|
16
|
+
self.called_method = called_method
|
17
|
+
self.args = args
|
18
|
+
end
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
class << self
|
24
|
-
|
25
|
-
def method_missing(sym, *args)
|
26
|
-
::#{klass}Worker.enqueue(sym, *args)
|
20
|
+
def perform
|
21
|
+
# ::#{klass}.send(self.called_method, *self.args)
|
22
|
+
::#{klass}.send(:new, self.called_method, *self.args).deliver!
|
27
23
|
end
|
28
|
-
|
29
|
-
end
|
30
24
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
class << self
|
26
|
+
|
27
|
+
def method_missing(sym, *args)
|
28
|
+
::#{klass}Worker.enqueue(sym, *args)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
}
|
35
|
+
end
|
36
36
|
|
37
|
-
def
|
37
|
+
def method_missing_with_extras(method_symbol, *parameters) #:nodoc:
|
38
38
|
if match = matches_dynamic_method?(method_symbol)
|
39
39
|
case match[1]
|
40
40
|
when 'deliver'# then new(match[2], *parameters).deliver!
|
41
41
|
"#{self.name}Worker".constantize.enqueue(match[2], *parameters)
|
42
|
-
else
|
42
|
+
else
|
43
|
+
method_missing_without_extras(method_symbol, *parameters)
|
43
44
|
end
|
44
45
|
else
|
45
46
|
super
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
49
|
-
|
50
|
+
alias_method_chain :method_missing, :extras
|
51
|
+
|
52
|
+
end # class << self
|
50
53
|
|
51
54
|
end # Base
|
52
55
|
end # ActionMailer
|