Class: Kindly::Runner
- Inherits:
-
Object
- Object
- Kindly::Runner
- Defined in:
- lib/kindly/runner.rb
Instance Method Summary collapse
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #run(job_name) ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 |
# File 'lib/kindly/runner.rb', line 7 def initialize @queue = Queue.new @db = DB.new end |
Instance Method Details
#run(job_name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kindly/runner.rb', line 12 def run(job_name) job_id = @queue.pop(job_name) if job_id.nil? puts "No pending requests for #{job_name}." return false end job = @db.fetch_job(job_name, job_id) run_job(job) job.respond_to?(:output) ? job.output : {} end |