Class: RSpec::Multicore::EventWriter
- Inherits:
-
Object
- Object
- RSpec::Multicore::EventWriter
- Defined in:
- lib/rspec/multicore/reporter_bridge.rb
Overview
Serializes worker reporter events with a shared monotonic sequence.
Instance Attribute Summary collapse
-
#group_index ⇒ Object
Returns the value of attribute group_index.
Instance Method Summary collapse
- #emit(event, payload) ⇒ Object
-
#initialize(channel) ⇒ EventWriter
constructor
A new instance of EventWriter.
Constructor Details
#initialize(channel) ⇒ EventWriter
Returns a new instance of EventWriter.
137 138 139 140 141 |
# File 'lib/rspec/multicore/reporter_bridge.rb', line 137 def initialize(channel) @channel = channel @sequence = 0 @lock = Mutex.new end |
Instance Attribute Details
#group_index ⇒ Object
Returns the value of attribute group_index.
135 136 137 |
# File 'lib/rspec/multicore/reporter_bridge.rb', line 135 def group_index @group_index end |
Instance Method Details
#emit(event, payload) ⇒ Object
143 144 145 146 147 148 |
# File 'lib/rspec/multicore/reporter_bridge.rb', line 143 def emit(event, payload) @lock.synchronize do @sequence += 1 @channel.write([:event, group_index, @sequence, event, payload]) end end |