Class: Que::ResultQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/que/result_queue.rb

Instance Method Summary collapse

Constructor Details

#initializeResultQueue

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

#clearObject



17
18
19
# File 'lib/que/result_queue.rb', line 17

def clear
  sync { @array.pop(@array.size) }
end

#lengthObject



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_aObject



21
22
23
# File 'lib/que/result_queue.rb', line 21

def to_a
  sync { @array.dup }
end