Class: Spellr::Check
- Inherits:
-
Object
- Object
- Spellr::Check
- Defined in:
- lib/spellr/check.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#reporter ⇒ Object
readonly
Returns the value of attribute reporter.
Instance Method Summary collapse
- #check ⇒ Object
-
#check_parallel ⇒ Object
rubocop:disable Metrics/MethodLength.
- #exit_code ⇒ Object
-
#initialize(files: [], reporter: Spellr.config.reporter) ⇒ Check
constructor
A new instance of Check.
Constructor Details
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
21 22 23 |
# File 'lib/spellr/check.rb', line 21 def files @files end |
#reporter ⇒ Object (readonly)
Returns the value of attribute reporter.
21 22 23 |
# File 'lib/spellr/check.rb', line 21 def reporter @reporter end |
Instance Method Details
#check ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/spellr/check.rb', line 33 def check return check_parallel if reporter.parallel? files.each do |file| check_and_count_file(file) end reporter.finish end |
#check_parallel ⇒ Object
rubocop:disable Metrics/MethodLength
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/spellr/check.rb', line 43 def check_parallel # rubocop:disable Metrics/MethodLength acc_reporter = @reporter Parallel.each(files, finish: ->(_, _, result) { acc_reporter.output << result }) do |file| @reporter = acc_reporter.class.new(Spellr::OutputStubbed.new) check_and_count_file(file) reporter.output end @reporter = acc_reporter reporter.finish end |
#exit_code ⇒ Object
23 24 25 |
# File 'lib/spellr/check.rb', line 23 def exit_code reporter.exit_code end |