Class: Resque::Plugins::AsyncDeliver::MailJob

Inherits:
Object
  • Object
show all
Defined in:
lib/async_deliver/mail_job.rb

Class Method Summary collapse

Class Method Details

.perform(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/async_deliver/mail_job.rb', line 7

def self.perform(*args)
  mailer = args.shift.constantize
  method_name = args.shift
  arguments = []
  args.each do |a|
    if a.is_a? Hash and
      klass = a['async_deliver_class'] || a[:async_deliver_class] and
      id = a['async_deliver_id'] || a[:async_deliver_id]
      arguments << klass.constantize.find(id)
    else
      arguments << a
    end
  end
  mailer.__send__(method_name, *arguments).deliver
end