Class: RSpec::Multicore::Pool
- Inherits:
-
Object
- Object
- RSpec::Multicore::Pool
- Defined in:
- lib/rspec/multicore/pool.rb
Overview
Schedules groups across persistent workers and replays ordered results.
Defined Under Namespace
Classes: Worker
Instance Attribute Summary collapse
-
#workers ⇒ Object
readonly
Returns the value of attribute workers.
Instance Method Summary collapse
-
#initialize(reporter:, configuration:, workers: RSpec::Multicore.workers) ⇒ Pool
constructor
A new instance of Pool.
- #run(groups) ⇒ Object
Constructor Details
#initialize(reporter:, configuration:, workers: RSpec::Multicore.workers) ⇒ Pool
Returns a new instance of Pool.
11 12 13 14 15 16 17 |
# File 'lib/rspec/multicore/pool.rb', line 11 def initialize(reporter:, configuration:, workers: RSpec::Multicore.workers) @reporter = reporter @configuration = configuration @worker_count = workers @workers = [] @failures = [] end |
Instance Attribute Details
#workers ⇒ Object (readonly)
Returns the value of attribute workers.
9 10 11 |
# File 'lib/rspec/multicore/pool.rb', line 9 def workers @workers end |
Instance Method Details
#run(groups) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rspec/multicore/pool.rb', line 19 def run(groups) return [] if groups.empty? prepare(groups) spawn_workers event_loop reap_workers report_failures @results rescue StandardError => e @failures << e report_failures Array.new(groups.size, false) ensure cleanup end |