class Priority::NamedQueue(V)

Defined in:

priority-queue/named_queue.cr

Instance Method Summary

Instance methods inherited from class Priority::Queue(V)

<<(item : Item(V)) <<, push(priority : Int32, value : V, name = nil)
push(item : Item(V))
push(*items : Item(V))
push

Instance Method Detail

def named_items #

[View source]
def pop(n : Int) #
Description copied from class Array(Priority::Item(V))

Removes the last n values from self, at index size - 1. This method returns an array of the removed values, with the original order preserved.

If n is greater than the size of self, all values will be removed from self without raising an error.

a = ["a", "b", "c"]
a.pop(2) # => ["b", "c"]
a        # => ["a"]

a = ["a", "b", "c"]
a.pop(4) # => ["a", "b", "c"]
a        # => []

See also: #truncate.


[View source]
def pop #
Description copied from class Array(Priority::Item(V))

Removes the last value from self, at index size - 1. This method returns the removed value. Raises IndexError if array is of 0 size.

a = ["a", "b", "c"]
a.pop # => "c"
a     # => ["a", "b"]

See also: #truncate.


[View source]
def push(item : Item(V)) #

[View source]
def shift(n : Int) #
Description copied from class Array(Priority::Item(V))

Removes the first n values of self, starting at index 0. This method returns an array of the removed values.

If n is greater than the size of self, all values will be removed from self without raising an error.

a = ["a", "b", "c"]
a.shift # => "a"
a       # => ["b", "c"]

a = ["a", "b", "c"]
a.shift(4) # => ["a", "b", "c"]
a          # => []

See also: #truncate.


[View source]
def shift #
Description copied from class Array(Priority::Item(V))

Removes the first value of self, at index 0. This method returns the removed value. If the array is empty, it raises IndexError.

a = ["a", "b", "c"]
a.shift # => "a"
a       # => ["b", "c"]

See also: #truncate.


[View source]