6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/delayed_job_mailer.rb', line 6
def self.included(base)
base.class_eval do
class << self
def method_missing(method_symbol, *params)
if ::Delayed::Mailer.excluded_environments &&
::Delayed::Mailer.excluded_environments.include?(::RAILS_ENV.to_sym)
return super(method_symbol, *params)
end
case method_symbol.id2name
when /^deliver_([_a-z]\w*)\!/ then super(method_symbol, *params)
when /^deliver_([_a-z]\w*)/ then self.send_later("#{method_symbol}!", *params)
else super(method_symbol, *params)
end
end
end
end
def self.excluded_environments=(*environments)
@@excluded_environments = environments && environments.flatten.collect! { |env| env.to_sym }
end
def self.excluded_environments
@@excluded_environments ||= []
end
end
|