Class: DatabaseConsistency::Checkers::ValidatorsFractionChecker
- Inherits:
-
BaseChecker
- Object
- BaseChecker
- DatabaseConsistency::Checkers::ValidatorsFractionChecker
- Defined in:
- lib/database_consistency/checkers/validators_fraction_checkers/validators_fraction_checker.rb
Overview
The base class for validator fraction checkers
Direct Known Subclasses
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#validators ⇒ Object
readonly
Returns the value of attribute validators.
Instance Method Summary collapse
- #column_or_attribute_name ⇒ String
-
#initialize(model, attribute, validators) ⇒ ValidatorsFractionChecker
constructor
A new instance of ValidatorsFractionChecker.
- #table_or_model_name ⇒ String
Methods inherited from BaseChecker
checker_name, enabled?, #enabled?, #report, #report_if_enabled?
Constructor Details
#initialize(model, attribute, validators) ⇒ ValidatorsFractionChecker
Returns a new instance of ValidatorsFractionChecker.
9 10 11 12 13 14 |
# File 'lib/database_consistency/checkers/validators_fraction_checkers/validators_fraction_checker.rb', line 9 def initialize(model, attribute, validators) super() @model = model @attribute = attribute @validators = validators.select(&method(:filter)) end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
7 8 9 |
# File 'lib/database_consistency/checkers/validators_fraction_checkers/validators_fraction_checker.rb', line 7 def attribute @attribute end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
7 8 9 |
# File 'lib/database_consistency/checkers/validators_fraction_checkers/validators_fraction_checker.rb', line 7 def model @model end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
7 8 9 |
# File 'lib/database_consistency/checkers/validators_fraction_checkers/validators_fraction_checker.rb', line 7 def validators @validators end |
Instance Method Details
#column_or_attribute_name ⇒ String
17 18 19 |
# File 'lib/database_consistency/checkers/validators_fraction_checkers/validators_fraction_checker.rb', line 17 def column_or_attribute_name @column_or_attribute_name ||= attribute.to_s end |
#table_or_model_name ⇒ String
22 23 24 |
# File 'lib/database_consistency/checkers/validators_fraction_checkers/validators_fraction_checker.rb', line 22 def table_or_model_name @table_or_model_name ||= model.name.to_s end |