motion/reactor/queue.rb in bubble-wrap-1.8.0 vs motion/reactor/queue.rb in bubble-wrap-1.9.0
- old
+ new
@@ -1,11 +1,11 @@
module BubbleWrap
module Reactor
# A GCD scheduled, linear queue.
#
- # This class provides a simple “Queue” like abstraction on top of the
- # GCD scheduler.
+ # This class provides a simple “Queue” like abstraction on top of the
+ # GCD scheduler.
#
# Useful as an API sugar for stateful protocols
#
# q = BubbleWrap::Reactor::Queue.new
# q.push('one', 'two', 'three')
@@ -27,20 +27,20 @@
# The size of the queue
def size
@items.size
end
- # Push items onto the work queue. The items will not appear in the queue
+ # Push items onto the work queue. The items will not appear in the queue
# immediately, but will be scheduled for addition.
def push(*items)
- ::BubbleWrap::Reactor.schedule do
+ ::BubbleWrap::Reactor.schedule do
@items.push(*items)
@popq.shift.call @items.shift until @items.empty? || @popq.empty?
end
end
- # Pop items off the queue, running the block on the work queue. The pop
- # will not happen immediately, but at some point in the future, either
+ # Pop items off the queue, running the block on the work queue. The pop
+ # will not happen immediately, but at some point in the future, either
# in the next tick, if the queue has data, or when the queue is populated.
def pop(*args, &blk)
cb = proc do
blk.call(*args)
end