Class: UnifiedQueues::Single::Driver::EventedQueueDriver

Inherits:
UnifiedQueues::Single::Driver show all
Defined in:
lib/unified-queues/single/driver/evented-queue.rb

Overview

EventedQueue queue driver. Uses the EventedQueue class from the evented-queue gem. Priority is supported depending to arguments.

Instance Attribute Summary

Attributes inherited from UnifiedQueues::Single::Driver

#native

Instance Method Summary collapse

Methods inherited from UnifiedQueues::Single::Driver

#evented?, #initialize, #linear?

Constructor Details

This class inherits a constructor from UnifiedQueues::Single::Driver

Instance Method Details

#clear!(&block) ⇒ Object

Clears the queue.



69
70
71
# File 'lib/unified-queues/single/driver/evented-queue.rb', line 69

def clear!(&block)
    @native.clear(&block)
end

#empty?(&block) ⇒ Boolean

Indicates queue is empty.

Parameters:

  • +true+ (Boolean)

    if it’s, false otherwise

Returns:

  • (Boolean)


61
62
63
# File 'lib/unified-queues/single/driver/evented-queue.rb', line 61

def empty?(&block)
    @native.empty?(&block)
end

#length(&block) ⇒ Integer

Returns length of the queue.

Returns:

  • (Integer)


78
79
80
# File 'lib/unified-queues/single/driver/evented-queue.rb', line 78

def length(&block)
    @native.length(&block)
end

#pop(blocking = false, &block) ⇒ Object

Pops value out of the queue.

Parameters:

  • blocking (Boolean|Integer) (defaults to: false)

    true or timeout if it should block, false otherwise

  • queue (Object)

    value



52
53
54
# File 'lib/unified-queues/single/driver/evented-queue.rb', line 52

def pop(blocking = false, &block)
    @native.pop(&block)
end

#push(value, key = value, &block) ⇒ Object

Pushes the value into the queue. Priority is supported depending to arguments.

Parameters:

  • value (Object)

    value for push

  • key (Object) (defaults to: value)

    key for priority queues



41
42
43
# File 'lib/unified-queues/single/driver/evented-queue.rb', line 41

def push(value, key = value, &block)
    @native.push(value, key, &block)
end

#type:linear

Returs type of the queue.

Returns:

  • (:linear)


87
88
89
# File 'lib/unified-queues/single/driver/evented-queue.rb', line 87

def type
    :linear
end