Class: DatabaseConsistency::Checkers::BaseChecker
- Inherits:
-
Object
- Object
- DatabaseConsistency::Checkers::BaseChecker
show all
- Defined in:
- lib/database_consistency/checkers/base_checker.rb
Overview
The base class for checkers
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.checker_name ⇒ String
15
16
17
|
# File 'lib/database_consistency/checkers/base_checker.rb', line 15
def self.checker_name
@checker_name ||= name.split('::').last
end
|
.enabled?(configuration) ⇒ Boolean
10
11
12
|
# File 'lib/database_consistency/checkers/base_checker.rb', line 10
def self.enabled?(configuration)
configuration.enabled?('DatabaseConsistencyCheckers', checker_name)
end
|
Instance Method Details
#enabled?(configuration) ⇒ Boolean
40
41
42
|
# File 'lib/database_consistency/checkers/base_checker.rb', line 40
def enabled?(configuration)
configuration.enabled?(table_or_model_name, column_or_attribute_name, checker_name)
end
|
#report(catch_errors: true) ⇒ Hash, ...
22
23
24
25
26
27
28
29
30
|
# File 'lib/database_consistency/checkers/base_checker.rb', line 22
def report(catch_errors: true)
return unless preconditions
@report ||= check
rescue StandardError => e
raise e unless catch_errors
RescueError.call(e)
end
|
#report_if_enabled?(configuration) ⇒ Hash, ...
33
34
35
|
# File 'lib/database_consistency/checkers/base_checker.rb', line 33
def report_if_enabled?(configuration)
report if enabled?(configuration)
end
|