Class: DatabaseConsistency::Checkers::ValidatorChecker

Inherits:
BaseChecker
  • Object
show all
Defined in:
lib/database_consistency/checkers/validator_checker.rb

Overview

The base class for validator checker

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseChecker

checker_name, enabled?, #enabled?, #report, #report_if_enabled?

Constructor Details

#initialize(model, attribute, validator) ⇒ ValidatorChecker

Returns a new instance of ValidatorChecker.



9
10
11
12
13
# File 'lib/database_consistency/checkers/validator_checker.rb', line 9

def initialize(model, attribute, validator)
  @model = model
  @attribute = attribute
  @validator = validator
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



7
8
9
# File 'lib/database_consistency/checkers/validator_checker.rb', line 7

def attribute
  @attribute
end

#modelObject (readonly)

Returns the value of attribute model.



7
8
9
# File 'lib/database_consistency/checkers/validator_checker.rb', line 7

def model
  @model
end

#validatorObject (readonly)

Returns the value of attribute validator.



7
8
9
# File 'lib/database_consistency/checkers/validator_checker.rb', line 7

def validator
  @validator
end

Instance Method Details

#column_or_attribute_nameString

Returns:

  • (String)


16
17
18
# File 'lib/database_consistency/checkers/validator_checker.rb', line 16

def column_or_attribute_name
  @column_or_attribute_name ||= attribute.to_s
end

#table_or_model_nameString

Returns:

  • (String)


21
22
23
# File 'lib/database_consistency/checkers/validator_checker.rb', line 21

def table_or_model_name
  @table_or_model_name ||= model.name.to_s
end