Class: Spellr::Check

Inherits:
Object
  • Object
show all
Includes:
StringFormat
Defined in:
lib/spellr/check.rb

Direct Known Subclasses

CheckDryRun

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StringFormat

aqua, bold, green, key, lighten, normal, pluralize, red

Constructor Details

#initialize(files: [], reporter: Spellr.config.reporter) ⇒ Check

Returns a new instance of Check.



18
19
20
21
22
# File 'lib/spellr/check.rb', line 18

def initialize(files: [], reporter: Spellr.config.reporter)
  @files = files

  @reporter = reporter
end

Instance Attribute Details

#filesObject (readonly)

Returns the value of attribute files.



10
11
12
# File 'lib/spellr/check.rb', line 10

def files
  @files
end

#reporterObject (readonly)

Returns the value of attribute reporter.



10
11
12
# File 'lib/spellr/check.rb', line 10

def reporter
  @reporter
end

Instance Method Details

#checkObject



24
25
26
27
28
29
30
31
32
# File 'lib/spellr/check.rb', line 24

def check
  if Spellr.config.parallel
    parallel_check
  else
    files.each { |file| check_and_count_file(file, reporter) }
  end

  reporter.finish
end

#exit_codeObject



14
15
16
# File 'lib/spellr/check.rb', line 14

def exit_code
  reporter.exit_code
end