Class: TLDR::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/tldr/executor.rb

Instance Method Summary collapse

Constructor Details

#initializeExecutor

Returns a new instance of Executor.



3
4
5
6
7
8
# File 'lib/tldr/executor.rb', line 3

def initialize
  @thread_pool = Concurrent::ThreadPoolExecutor.new(
    name: "tldr",
    auto_terminate: true
  )
end

Instance Method Details

#execute(plan, &blk) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/tldr/executor.rb', line 10

def execute plan, &blk
  if plan.strategy.parallel?
    run_in_sequence(plan.strategy.prepend_sequential_tests, &blk) +
      run_in_parallel(plan.strategy.parallel_tests_and_groups, &blk) +
      run_in_sequence(plan.strategy.append_sequential_tests, &blk)
  else
    run_in_sequence(plan.tests, &blk)
  end
end