Class: Gotta::Queue::Memory::Driver

Inherits:
Object
  • Object
show all
Defined in:
lib/gotta/queue/memory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Driver

Returns a new instance of Driver.



29
30
31
32
# File 'lib/gotta/queue/memory.rb', line 29

def initialize(name)
  @name = name
  @queue = ::Queue.new
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



27
28
29
# File 'lib/gotta/queue/memory.rb', line 27

def name
  @name
end

Instance Method Details

#popObject



34
35
36
# File 'lib/gotta/queue/memory.rb', line 34

def pop
  @queue.pop
end

#processObject



42
43
44
45
46
# File 'lib/gotta/queue/memory.rb', line 42

def process
  loop do
    yield pop
  end
end

#push(value) ⇒ Object



38
39
40
# File 'lib/gotta/queue/memory.rb', line 38

def push(value)
  @queue.push(value)
end