6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/delayed/mailer.rb', line 6
def self.included(base)
class << base
alias_method :original_method_missing, :method_missing
def method_missing(method_symbol, *params, &block)
method_name = method_symbol.to_s
case method_name
when /^deliver_([_a-z]\w*)$/
send_later("#{method_name}!", *params, &block)
when /^deliver_([_a-z]\w*)!$/
original_method_missing(method_name.gsub(/!$/,""), *params, &block)
else
original_method_missing(method_name, *params, &block)
end
end
end
end
|