module Payola::Worker

Attributes

registry[RW]

Public Class Methods

autofind() click to toggle source
# File lib/payola/worker.rb, line 19
def autofind
  # prefer ActiveJob over the other workers
  if Payola::Worker::ActiveJob.can_run?
    return Payola::Worker::ActiveJob
  end
  
  registry.values.each do |worker|
    if worker.can_run?
      return worker
    end
  end

  raise "No eligible background worker systems found."
end
find(symbol) click to toggle source
# File lib/payola/worker.rb, line 11
def find(symbol)
  if registry.has_key? symbol
    return registry[symbol]
  else
    raise "No such worker type: #{symbol}"
  end
end