Class: RSpec::Multicore::ParallelGroups

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rspec/multicore/runner_patch.rb

Overview

Enumerable wrapper that substitutes parallel work only for RSpec's map call.

Instance Method Summary collapse

Constructor Details

#initialize(groups, configuration) ⇒ ParallelGroups

Returns a new instance of ParallelGroups.



9
10
11
12
# File 'lib/rspec/multicore/runner_patch.rb', line 9

def initialize(groups, configuration)
  @groups = groups
  @configuration = configuration
end

Instance Method Details

#each(&block) ⇒ Object



14
# File 'lib/rspec/multicore/runner_patch.rb', line 14

def each(&block) = block ? @groups.each(&block) : enum_for(:each)

#mapObject



16
17
18
19
20
# File 'lib/rspec/multicore/runner_patch.rb', line 16

def map
  return enum_for(:map) unless block_given?

  Pool.new(reporter: @configuration.reporter, configuration: @configuration).run(@groups)
end