Class: DatabaseConsistency::Writers::Simple::Base
- Inherits:
-
Object
- Object
- DatabaseConsistency::Writers::Simple::Base
- Defined in:
- lib/database_consistency/writers/simple/base.rb
Overview
:nodoc:
Direct Known Subclasses
AssociationMissingIndex, AssociationMissingNullConstraint, DefaultMessage, HasOneMissingUniqueIndex, InconsistentTypes, LengthValidatorGreaterLimit, LengthValidatorLowerLimit, LengthValidatorMissing, MissingForeignKey, MissingUniqueIndex, MissingUniquenessValidation, NullConstraintAssociationMissesValidator, NullConstraintMissesValidator, NullConstraintMissing, PossibleNull, RedundantIndex, RedundantUniqueIndex, SmallPrimaryKey
Constant Summary collapse
- COLORS =
{ blue: "\e[34m", yellow: "\e[33m", green: "\e[32m", red: "\e[31m" }.freeze
- COLOR_BY_STATUS =
{ ok: :green, warning: :yellow, fail: :red }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(report, config:) ⇒ Base
constructor
A new instance of Base.
- #msg ⇒ Object
- #unique_key ⇒ Object
Constructor Details
#initialize(report, config:) ⇒ Base
Returns a new instance of Base.
30 31 32 33 |
# File 'lib/database_consistency/writers/simple/base.rb', line 30 def initialize(report, config:) @report = report @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
28 29 30 |
# File 'lib/database_consistency/writers/simple/base.rb', line 28 def config @config end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
28 29 30 |
# File 'lib/database_consistency/writers/simple/base.rb', line 28 def report @report end |
Class Method Details
.with(text) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/database_consistency/writers/simple/base.rb', line 20 def self.with(text) Class.new(self) do define_method :template do text end end end |
Instance Method Details
#msg ⇒ Object
35 36 37 |
# File 'lib/database_consistency/writers/simple/base.rb', line 35 def msg "#{report.checker_name} #{status_text} #{key_text} #{}".strip end |
#unique_key ⇒ Object
39 40 41 |
# File 'lib/database_consistency/writers/simple/base.rb', line 39 def unique_key { class: self.class }.merge(unique_attributes) end |