Class: Hamster::MutableQueue

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
ReadCopyUpdate
Defined in:
lib/hamster/experimental/mutable_queue.rb

Instance Method Summary collapse

Methods included from ReadCopyUpdate

#eql?, #initialize

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hamster::ReadCopyUpdate

Instance Method Details

#dequeueObject



23
24
25
26
27
28
29
30
# File 'lib/hamster/experimental/mutable_queue.rb', line 23

def dequeue
  head = nil
  transform { |queue|
    head = queue.head
    queue.dequeue
  }
  head
end

#enqueue(item) ⇒ Object



17
18
19
# File 'lib/hamster/experimental/mutable_queue.rb', line 17

def enqueue(item)
  transform { |queue| queue.enqueue(item) }
end