Class: I18n::Tasks::Scanners::ScannerMultiplexer

Inherits:
Scanner
  • Object
show all
Defined in:
lib/i18n/tasks/scanners/scanner_multiplexer.rb

Overview

Note:

The scanners are run concurrently. A thread is spawned per each scanner.

Run multiple Scanners and merge their results.

Since:

  • 0.9.0

Instance Method Summary collapse

Constructor Details

#initialize(scanners:) ⇒ ScannerMultiplexer

Returns a new instance of ScannerMultiplexer.

Parameters:

Since:

  • 0.9.0



11
12
13
14
# File 'lib/i18n/tasks/scanners/scanner_multiplexer.rb', line 11

def initialize(scanners:)
  super()
  @scanners = scanners
end

Instance Method Details

#keysArray<Results::KeyOccurrences>

Note:

The scanners are run concurrently. A thread is spawned per each scanner.

Collect the results of all the scanners. Occurrences of a key from multiple scanners are merged.

Returns:

Since:

  • 0.9.0



20
21
22
# File 'lib/i18n/tasks/scanners/scanner_multiplexer.rb', line 20

def keys
  Results::KeyOccurrences.merge_keys collect_results.flatten(1)
end