Module: DatWorkerPool::Queue::InstanceMethods
- Defined in:
- lib/dat-worker-pool/queue.rb
Instance Method Summary collapse
- #dwp_pop ⇒ Object
- #dwp_push(*args) ⇒ Object
- #dwp_shutdown ⇒ Object
- #dwp_signal_shutdown ⇒ Object
- #dwp_start ⇒ Object
- #running? ⇒ Boolean
- #shutdown? ⇒ Boolean
-
#work_items ⇒ Object
overwrite this method to add custom logic for reading the current work items on the queue.
Instance Method Details
#dwp_pop ⇒ Object
46 47 48 49 |
# File 'lib/dat-worker-pool/queue.rb', line 46 def dwp_pop return if self.shutdown? pop! end |
#dwp_push(*args) ⇒ Object
41 42 43 44 |
# File 'lib/dat-worker-pool/queue.rb', line 41 def dwp_push(*args) raise "Unable to add work when shut down" if self.shutdown? push!(*args) end |
#dwp_shutdown ⇒ Object
28 29 30 31 |
# File 'lib/dat-worker-pool/queue.rb', line 28 def dwp_shutdown self.dwp_signal_shutdown shutdown! end |
#dwp_signal_shutdown ⇒ Object
24 25 26 |
# File 'lib/dat-worker-pool/queue.rb', line 24 def dwp_signal_shutdown @dwp_running = false end |
#dwp_start ⇒ Object
19 20 21 22 |
# File 'lib/dat-worker-pool/queue.rb', line 19 def dwp_start @dwp_running = true start! end |
#running? ⇒ Boolean
33 34 35 |
# File 'lib/dat-worker-pool/queue.rb', line 33 def running? !!@dwp_running end |
#shutdown? ⇒ Boolean
37 38 39 |
# File 'lib/dat-worker-pool/queue.rb', line 37 def shutdown? !self.running? end |
#work_items ⇒ Object
overwrite this method to add custom logic for reading the current work items on the queue
15 16 17 |
# File 'lib/dat-worker-pool/queue.rb', line 15 def work_items raise NotImplementedError end |