Class: Spellr::Reporter
- Inherits:
-
Object
- Object
- Spellr::Reporter
- Includes:
- StringFormat
- Defined in:
- lib/spellr/reporter.rb
Instance Attribute Summary collapse
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
- #call(token) ⇒ Object
- #finish(checked) ⇒ Object
-
#initialize ⇒ Reporter
constructor
A new instance of Reporter.
Methods included from StringFormat
aqua, bold, color_enabled?, normal, pluralize, red
Constructor Details
#initialize ⇒ Reporter
Returns a new instance of Reporter.
11 12 13 |
# File 'lib/spellr/reporter.rb', line 11 def initialize @total = 0 end |
Instance Attribute Details
#total ⇒ Object
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 |