class UnifiedQueues::Single::Driver::ArrayDriver

Array queue driver. Uses standard library Array class for queueing. Priority isn't supported.

Public Instance Methods

clear!() click to toggle source

Clears the queue.

# File lib/unified-queues/single/driver/array.rb, line 67
def clear!
    @native.clear
end
empty?() click to toggle source

Indicates queue is empty. @param [Boolean] true if it's, false otherwise

# File lib/unified-queues/single/driver/array.rb, line 59
def empty?
    @native.empty?
end
length() click to toggle source

Returns length of the queue. @return [Integer]

# File lib/unified-queues/single/driver/array.rb, line 76
def length
    @native.length
end
pop(blocking = false) click to toggle source

Pops value out of the queue. Blocking isn'ลง supported.

@param [Boolean|Integer] blocking true or timeout if it should block, false otherwise @return [Object] out-queued value

# File lib/unified-queues/single/driver/array.rb, line 50
def pop(blocking = false)
    @native.shift
end
push(value, key = value) click to toggle source

Pushes the value into the queue. Priority isn't supported.

@param [Object] value value for push @param [Object] key key for priority queues

# File lib/unified-queues/single/driver/array.rb, line 39
def push(value, key = value)
    @native.push(value)
end
type() click to toggle source

Returs type of the queue. @return [:linear]

# File lib/unified-queues/single/driver/array.rb, line 85
def type
    :linear
end