Class: Reqless::JobReservers::Delegating
- Inherits:
-
Struct
- Object
- Struct
- Reqless::JobReservers::Delegating
- Defined in:
- lib/reqless/job_reservers/delegating.rb
Overview
to check for work.
Instance Attribute Summary collapse
-
#reservers ⇒ Object
Returns the value of attribute reservers.
Instance Method Summary collapse
Instance Attribute Details
#reservers ⇒ Object
Returns the value of attribute reservers
4 5 6 |
# File 'lib/reqless/job_reservers/delegating.rb', line 4 def reservers @reservers end |
Instance Method Details
#description ⇒ Object
5 6 7 |
# File 'lib/reqless/job_reservers/delegating.rb', line 5 def description "Delegating Reserver" end |
#prep_for_work! ⇒ Object
9 10 11 |
# File 'lib/reqless/job_reservers/delegating.rb', line 9 def prep_for_work! # nothing here on purpose end |
#queues ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/reqless/job_reservers/delegating.rb', line 13 def queues Enumerator.new do |yielder| reservers.each do |reserver| reserver.queues.each {|queue| yielder << queue} end end end |
#reserve ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/reqless/job_reservers/delegating.rb', line 21 def reserve reservers.each do |reserver| if (job = reserver.reserve) return job end end nil end |