Class: EventedQueue::Recurring
- Inherits:
-
EventedQueue
- Object
- AbstractEventedQueue
- EventedQueue
- EventedQueue::Recurring
- Defined in:
- lib/evented-queue/recurring.rb
Overview
Recurring evented queue implementation.
Instance Attribute Summary collapse
-
#scheduler ⇒ Proc
Holds scheduling routine.
Attributes inherited from EventedQueue
Instance Method Summary collapse
-
#initialize(stack = UnifiedQueues::Single::new(Array), &scheduler) ⇒ Recurring
constructor
Constructor.
-
#pop {|Object| ... } ⇒ Object
Pushes value out of the queue.
Methods inherited from EventedQueue
#clear, #empty?, #length, #push
Methods inherited from AbstractEventedQueue
#clear, #empty?, #length, #push
Constructor Details
#initialize(stack = UnifiedQueues::Single::new(Array), &scheduler) ⇒ Recurring
Constructor.
25 26 27 28 |
# File 'lib/evented-queue/recurring.rb', line 25 def initialize(stack = UnifiedQueues::Single::new(Array), &scheduler) super(stack) @scheduler = scheduler end |
Instance Attribute Details
#scheduler ⇒ Proc
Holds scheduling routine.
17 18 19 |
# File 'lib/evented-queue/recurring.rb', line 17 def scheduler @scheduler end |
Instance Method Details
#pop {|Object| ... } ⇒ Object
Pushes value out of the queue.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/evented-queue/recurring.rb', line 37 def pop(&block) if self.empty? result = super(&block) else result = super(&block) if @scheduler.nil? self.pop(&block) else @scheduler.call(Proc::new { self.pop(&block) }) end end return result end |