Class: Spellr::Reporter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StringFormat

aqua, bold, color_enabled?, normal, pluralize, red

Constructor Details

#initializeReporter

Returns a new instance of Reporter.



11
12
13
# File 'lib/spellr/reporter.rb', line 11

def initialize
  @total = 0
end

Instance Attribute Details

#totalObject

Returns the value of attribute total.



9
10
11
# File 'lib/spellr/reporter.rb', line 9

def total
  @total
end

Instance Method Details

#call(token) ⇒ Object



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

def call(token)
  puts "#{aqua token.location} #{token.line.highlight(token.char_range).strip}"

  self.total += 1
end

#finish(checked) ⇒ Object



15
16
17
18
19
# File 'lib/spellr/reporter.rb', line 15

def finish(checked)
  puts "\n"
  puts "#{pluralize 'file', checked} checked"
  puts "#{pluralize 'error', total} found"
end