Class: Gotta::Queue::Memory::Driver
- Inherits:
-
Object
- Object
- Gotta::Queue::Memory::Driver
- Defined in:
- lib/gotta/queue/memory.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ Driver
constructor
A new instance of Driver.
- #pop ⇒ Object
- #process ⇒ Object
- #push(value) ⇒ Object
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
#name ⇒ Object (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
#pop ⇒ Object
34 35 36 |
# File 'lib/gotta/queue/memory.rb', line 34 def pop @queue.pop end |
#process ⇒ Object
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 |