class Leftovers::Reporter

Public Instance Methods

prepare() click to toggle source
# File lib/leftovers/reporter.rb, line 5
def prepare; end
report(only_test:, none:) click to toggle source
# File lib/leftovers/reporter.rb, line 7
def report(only_test:, none:)
  report_list('Only directly called in tests:', only_test)
  report_list('Not directly called at all:', none)
  report_instructions

  1
end
report_success() click to toggle source
# File lib/leftovers/reporter.rb, line 15
def report_success
  puts green('Everything is used')

  0
end

Private Instance Methods

aqua(string) click to toggle source
# File lib/leftovers/reporter.rb, line 55
def aqua(string)
  "\e[36m#{string}\e[0m"
end
green(string) click to toggle source
# File lib/leftovers/reporter.rb, line 51
def green(string)
  "\e[32m#{string}\e[0m"
end
grey(string) click to toggle source
# File lib/leftovers/reporter.rb, line 59
def grey(string)
  "\e[2m#{string}\e[0m"
end
print_definition(definition) click to toggle source
puts(string) click to toggle source
# File lib/leftovers/reporter.rb, line 43
def puts(string)
  Leftovers.puts(string)
end
red(string) click to toggle source
# File lib/leftovers/reporter.rb, line 47
def red(string)
  "\e[31m#{string}\e[0m"
end
report_instructions() click to toggle source
# File lib/leftovers/reporter.rb, line 23
    def report_instructions
      puts <<~HELP

        how to resolve: #{green Leftovers.resolution_instructions_link}
      HELP
    end
report_list(title, list) click to toggle source
# File lib/leftovers/reporter.rb, line 30
def report_list(title, list)
  return if list.empty?

  puts red(title)
  list.each { |d| print_definition(d) }
end