Class: Forspell::Runner
- Inherits:
-
Object
- Object
- Forspell::Runner
- Defined in:
- lib/forspell/runner.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(files:, speller:, reporter:) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(files:, speller:, reporter:) ⇒ Runner
Returns a new instance of Runner.
6 7 8 9 10 |
# File 'lib/forspell/runner.rb', line 6 def initialize(files:, speller:, reporter:) @files = files @speller = speller @reporter = reporter end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/forspell/runner.rb', line 12 def call increment = (@files.size / 100.0).ceil total = @files.size <= 100 ? @files.size : 100 @reporter. = ProgressBar.create(total: total, output: $stderr) @files.each_with_index do |path, index| process_file path @reporter..increment if (index + 1) % increment == 0 end @reporter.report self end |