Class: ActiveRecord::DataIntegrity::Cop

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

Overview

Checking cop base class

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Cop

Returns a new instance of Cop.



10
11
12
# File 'lib/active_record/data_integrity/cop/cop.rb', line 10

def initialize(model)
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



7
8
9
# File 'lib/active_record/data_integrity/cop/cop.rb', line 7

def model
  @model
end

Class Method Details

.cop_nameObject



14
15
16
# File 'lib/active_record/data_integrity/cop/cop.rb', line 14

def self.cop_name
  name.gsub('ActiveRecord::DataIntegrity::', '').gsub('::', '/')
end

Instance Method Details

#log(msg) ⇒ Object



18
19
20
# File 'lib/active_record/data_integrity/cop/cop.rb', line 18

def log(msg)
  ActiveRecord::DataIntegrity::Collector.log(self, msg)
end

#progress(subresult, false_char = 'E') ⇒ Object



22
23
24
25
26
27
# File 'lib/active_record/data_integrity/cop/cop.rb', line 22

def progress(subresult, false_char = 'E')
  ActiveRecord::DataIntegrity::Collector.progress(
    self,
    subresult ? Rainbow('.').green : Rainbow(false_char).red
  )
end