Class: RuboCop::Formatter::SimpleTextFormatter::Report

Inherits:
Object
  • Object
show all
Includes:
Colorizable, TextUtil
Defined in:
lib/rubocop/formatter/simple_text_formatter.rb

Overview

A helper class for building the report summary text.

Instance Method Summary collapse

Methods included from TextUtil

pluralize

Methods included from Colorizable

#colorize

Constructor Details

#initialize(file_count, offense_count, correction_count, rainbow) ⇒ Report

Returns a new instance of Report.



99
100
101
102
103
104
# File 'lib/rubocop/formatter/simple_text_formatter.rb', line 99

def initialize(file_count, offense_count, correction_count, rainbow)
  @file_count = file_count
  @offense_count = offense_count
  @correction_count = correction_count
  @rainbow = rainbow
end

Instance Method Details

#summaryObject



106
107
108
109
110
111
112
# File 'lib/rubocop/formatter/simple_text_formatter.rb', line 106

def summary
  if @correction_count.positive?
    "#{files} inspected, #{offenses} detected, #{corrections} corrected"
  else
    "#{files} inspected, #{offenses} detected"
  end
end