class ActiveWorker::JobQueue::RunRemotely::RemoteRunner

Public Class Methods

new(klass) click to toggle source
# File lib/active_worker/job_queue/run_remotely.rb, line 20
def initialize(klass)
  @klass = klass
end

Public Instance Methods

construct_args(method, params) click to toggle source
# File lib/active_worker/job_queue/run_remotely.rb, line 38
def construct_args(method, params)
  {
      "class_name" => @klass.to_s,
      "method"     => method.to_s,
      "params"     => params
  }
end
method_missing(method,*params) click to toggle source
# File lib/active_worker/job_queue/run_remotely.rb, line 24
def method_missing(method,*params)
  args = construct_args(method,params)
  thread = nil
  case RunRemotely.worker_mode
    when THREADED
      thread = Thread.new do
        ActiveWorker::JobQueue::JobExecuter.execute_task_from_args(args)
      end
    when RESQUE
      Resque.enqueue(JobExecuter,args)
  end
  thread
end