Class: ActiveRecord::DataIntegrity::Collector

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/data_integrity/collector.rb

Overview

collects result info for rendering

Class Method Summary collapse

Class Method Details

.log(cop, message) ⇒ Object



8
9
10
# File 'lib/active_record/data_integrity/collector.rb', line 8

def log(cop, message)
  data.push(cop: cop, message: message)
end

.progress(_cop, char) ⇒ Object



12
13
14
# File 'lib/active_record/data_integrity/collector.rb', line 12

def progress(_cop, char)
  print char
end

.renderObject



16
17
18
19
20
21
22
23
24
# File 'lib/active_record/data_integrity/collector.rb', line 16

def render
  group_data_by_cop_name.each do |cop_name, items|
    items.each do |item|
      puts "#{Rainbow(cop_name).red}:"\
             " #{Rainbow(item[:cop].model.name).yellow}"\
             " #{item[:message]}"
    end
  end
end