Class: Hamster::MutableQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/hamster/experimental/mutable_queue.rb

Instance Method Summary collapse

Dynamic Method Handling

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

Instance Method Details

#dequeueObject


16
17
18
19
20
21
22
23
# File 'lib/hamster/experimental/mutable_queue.rb', line 16

def dequeue
  head = nil
  transform do |queue|
    head = queue.head
    queue.dequeue
  end
  head
end

#enqueue(item) ⇒ Object


12
13
14
# File 'lib/hamster/experimental/mutable_queue.rb', line 12

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