Class: Harness::AsyncQueue
- Inherits:
-
Object
- Object
- Harness::AsyncQueue
- Defined in:
- lib/harness/async_queue.rb
Instance Attribute Summary collapse
-
#consumer ⇒ Object
readonly
Returns the value of attribute consumer.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
- #collector ⇒ Object
-
#initialize ⇒ AsyncQueue
constructor
A new instance of AsyncQueue.
- #push(msg) ⇒ Object
Constructor Details
#initialize ⇒ AsyncQueue
Returns a new instance of AsyncQueue.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/harness/async_queue.rb', line 7 def initialize @queue = Queue.new @consumer = Thread.new do loop do msg = queue.pop method_name = msg.first args = msg.last collector.__send__ method_name, *args end end end |
Instance Attribute Details
#consumer ⇒ Object (readonly)
Returns the value of attribute consumer.
5 6 7 |
# File 'lib/harness/async_queue.rb', line 5 def consumer @consumer end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
5 6 7 |
# File 'lib/harness/async_queue.rb', line 5 def queue @queue end |