Class: RubocopDirector::OutputFormatter
- Inherits:
-
Object
- Object
- RubocopDirector::OutputFormatter
- Defined in:
- lib/rubocop_director/output_formatter.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(ranged_files:, since:) ⇒ OutputFormatter
constructor
A new instance of OutputFormatter.
Constructor Details
#initialize(ranged_files:, since:) ⇒ OutputFormatter
Returns a new instance of OutputFormatter.
11 12 13 14 |
# File 'lib/rubocop_director/output_formatter.rb', line 11 def initialize(ranged_files:, since:) @ranged_files = ranged_files @since = since end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rubocop_director/output_formatter.rb', line 16 def call result = @ranged_files.each_with_object([]) do |file, result| result << "" result << "Path: #{file[:path]}" result << "Updated #{file[:updates_count]} times since #{@since}" result << "Offenses:" file[:offense_counts].each { |cop, count| result << " 🚓 #{cop} - #{count}" } result << "Refactoring value: #{file[:value]} (#{(100 * file[:value] / total_value.to_f).round(5)}%)" end Success(result) end |