Class: Qmin::Resque::BackgroundCallJob

Inherits:
Object
  • Object
show all
Defined in:
lib/qmin/resque/background_call_job.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, method_name, id) ⇒ BackgroundCallJob



12
13
14
15
16
17
18
19
20
# File 'lib/qmin/resque/background_call_job.rb', line 12

def initialize(klass, method_name, id)
  begin
    @klass = klass.is_a?(Class) ? klass : klass.constantize
    @method_name = method_name
    @id = id
  rescue => e
    ::Qmin::Qmin.current.report(e)
  end
end

Class Method Details

.perform(*args) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/qmin/resque/background_call_job.rb', line 4

def self.perform(*args)
  begin
    new(*args).perform
  rescue => e
    ::Qmin::Qmin.current.report(e)
  end
end

Instance Method Details

#performObject



22
23
24
25
26
27
28
29
# File 'lib/qmin/resque/background_call_job.rb', line 22

def perform
  begin
    instance = @klass.find(@id)
    instance.send(::Qmin.method_name_for_instance(instance, @method_name))
  rescue => e
    ::Qmin::Qmin.current.report(e)
  end
end