Class: ActionMailer::Base
- Inherits:
-
Object
- Object
- ActionMailer::Base
- Defined in:
- lib/delayed_job_extras/action_mailer.rb
Class Method Summary collapse
- .inherited(klass) ⇒ Object
-
.method_missing_with_extras(method_symbol, *parameters) ⇒ Object
:nodoc:.
Class Method Details
.inherited(klass) ⇒ Object
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 32 33 34 35 36 37 38 |
# File 'lib/delayed_job_extras/action_mailer.rb', line 7 def inherited(klass) super eval %{ class ::#{klass}Worker include Delayed::Job::Extras priority :immediate attr_accessor :called_method attr_accessor :args def initialize(called_method, *args) self.called_method = called_method self.args = args end def perform # ::#{klass}.send(self.called_method, *self.args) ::#{klass}.send(:new, self.called_method, *self.args).deliver! end class << self def method_missing(sym, *args) ::#{klass}Worker.enqueue(sym, *args) end end end } end |
.method_missing_with_extras(method_symbol, *parameters) ⇒ Object
:nodoc:
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/delayed_job_extras/action_mailer.rb', line 40 def method_missing_with_extras(method_symbol, *parameters) #:nodoc: if ActionMailer::Base.delivery_method == :test return method_missing_without_extras(method_symbol, *parameters) end if match = matches_dynamic_method?(method_symbol) case match[1] when 'deliver'# then new(match[2], *parameters).deliver! "#{self.name}Worker".constantize.enqueue(match[2], *parameters) else method_missing_without_extras(method_symbol, *parameters) end else super end end |