class Async::LimitedQueue
def dequeue
def dequeue item = super @full.signal return item end
def enqueue item
def enqueue item while limited? @full.wait end super end
def initialize(limit = 1, **options)
def initialize(limit = 1, **options) super(**options) @limit = limit @full = Notification.new end
def limited?
-
(Boolean)
- Whether trying to enqueue an item would block.
def limited? @items.size >= @limit end