Class: Spellr::Check

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Check.



21
22
23
24
25
# File 'lib/spellr/check.rb', line 21

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

Instance Attribute Details

#exit_codeObject (readonly)

Returns the value of attribute exit_code.



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

def exit_code
  @exit_code
end

#filesObject (readonly)

Returns the value of attribute files.



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

def files
  @files
end

#reporterObject (readonly)

Returns the value of attribute reporter.



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

def reporter
  @reporter
end

Instance Method Details

#checkObject



27
28
29
30
31
32
33
34
35
# File 'lib/spellr/check.rb', line 27

def check
  checked = 0
  files.each do |file|
    check_file(file)
    checked += 1
  end

  reporter.finish(checked) if reporter.respond_to?(:finish)
end