Class: ActiveRecord::DataIntegrity::Cop
- Inherits:
-
Object
- Object
- ActiveRecord::DataIntegrity::Cop
- Defined in:
- lib/active_record/data_integrity/cop/cop.rb
Overview
Checking cop base class
Direct Known Subclasses
Accordance::PrimaryKey, Accordance::TablePresence, BelongsTo::ForeignKey, HasMany::ForeignKey, Validation::Inclusion, Validation::Presence
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(model) ⇒ Cop
constructor
A new instance of Cop.
- #log(msg) ⇒ Object
- #progress(subresult, false_char = 'E') ⇒ Object
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
#model ⇒ Object (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_name ⇒ Object
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 |