class SuckerPunch::Backgroundable::JobRunner
Public Class Methods
new(receiver, method, args, options)
click to toggle source
# File lib/sucker_punch/backgroundable/job.rb, line 45 def initialize(receiver, method, args, options) @receiver, @method, @args, @options = receiver, method, args, options end
Public Instance Methods
run(seconds = 0)
click to toggle source
# File lib/sucker_punch/backgroundable/job.rb, line 49 def run(seconds = 0) if SuckerPunch::Backgroundable.configuration.enabled # run as SuckerPunch Job if seconds > 0 Job.perform_in(seconds, @receiver, @method, @args, @options) else Job.perform_async(@receiver, @method, @args, @options) end else # run without SuckerPunch or Celluloid @receiver = load(@receiver) if instantiate?(@options) call(@receiver, @method, *@args) end end