Class: Infrastruct::NonblockingQueue
- Inherits:
-
Object
- Object
- Infrastruct::NonblockingQueue
- Defined in:
- lib/infrastruct/nonblocking_queue.rb
Instance Method Summary collapse
-
#initialize ⇒ NonblockingQueue
constructor
A new instance of NonblockingQueue.
- #pop ⇒ Object
- #push(element) ⇒ Object
Constructor Details
#initialize ⇒ NonblockingQueue
Returns a new instance of NonblockingQueue.
3 4 5 |
# File 'lib/infrastruct/nonblocking_queue.rb', line 3 def initialize @queue = ::Queue.new end |
Instance Method Details
#pop ⇒ Object
11 12 13 |
# File 'lib/infrastruct/nonblocking_queue.rb', line 11 def pop @queue.pop(true) end |
#push(element) ⇒ Object
7 8 9 |
# File 'lib/infrastruct/nonblocking_queue.rb', line 7 def push(element) @queue.push(element) end |