Class: Que::ResultQueue
- Inherits:
-
Object
- Object
- Que::ResultQueue
- Defined in:
- lib/que/result_queue.rb
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ ResultQueue
constructor
A new instance of ResultQueue.
- #length ⇒ Object
- #push(item) ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize ⇒ ResultQueue
Returns a new instance of ResultQueue.
8 9 10 11 |
# File 'lib/que/result_queue.rb', line 8 def initialize @array = [] @mutex = Mutex.new end |
Instance Method Details
#clear ⇒ Object
17 18 19 |
# File 'lib/que/result_queue.rb', line 17 def clear sync { @array.pop(@array.size) } end |
#length ⇒ Object
25 26 27 |
# File 'lib/que/result_queue.rb', line 25 def length sync { @array.length } end |
#push(item) ⇒ Object
13 14 15 |
# File 'lib/que/result_queue.rb', line 13 def push(item) sync { @array.push(item) } end |
#to_a ⇒ Object
21 22 23 |
# File 'lib/que/result_queue.rb', line 21 def to_a sync { @array.dup } end |