class HardWorker::Worker
The worker class that actually gets the jobs from the queue and calls them. Expects the jobs to be procs.
Public Class Methods
new()
click to toggle source
# File lib/hard_worker/worker.rb, line 5 def initialize start_working end
Public Instance Methods
call_job(job)
click to toggle source
# File lib/hard_worker/worker.rb, line 19 def call_job(job) if job.respond_to?(:call) pp job.call else pp job&.perform end end
start_working()
click to toggle source
# File lib/hard_worker/worker.rb, line 9 def start_working loop do job = HardWorker.fetch_job next unless job call_job(job) puts 'fetching jobs...' end end