class Spellr::Reporter

Public Instance Methods

call(token) click to toggle source
Calls superclass method Spellr::BaseReporter#call
# File lib/spellr/reporter.rb, line 16
def call(token)
  super

  filenames << token.location.file.relative_path.to_s
  increment(:total)
end
finish() click to toggle source
# File lib/spellr/reporter.rb, line 8
def finish
  puts "\n"
  puts "#{pluralize 'file', counts[:checked]} checked"
  puts "#{pluralize 'error', counts[:total]} found"

  interactive_command if counts[:total].positive?
end

Private Instance Methods

filenames() click to toggle source
# File lib/spellr/reporter.rb, line 34
def filenames
  output.counts[:filenames] = Set.new unless output.counts.key?(:filenames)
  output.counts[:filenames]
end
interactive_command() click to toggle source
# File lib/spellr/reporter.rb, line 25
def interactive_command
  puts "\nto add or replace words interactively, run:"
  command = ['spellr', '--interactive']
  # sort is purely for repeatability for tests. so
  command.concat(counts[:filenames].to_a.sort) unless counts[:filenames].length > 20

  puts "  #{Shellwords.join(command)}"
end