Class: DatabaseConsistency::Processors::BaseProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/database_consistency/processors/base_processor.rb

Overview

The base class for processors

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration = nil) ⇒ BaseProcessor

Returns a new instance of BaseProcessor.

Parameters:



21
22
23
# File 'lib/database_consistency/processors/base_processor.rb', line 21

def initialize(configuration = nil)
  @configuration = configuration || Configuration.new
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



18
19
20
# File 'lib/database_consistency/processors/base_processor.rb', line 18

def configuration
  @configuration
end

Class Method Details

.checkersObject



14
15
16
# File 'lib/database_consistency/processors/base_processor.rb', line 14

def self.checkers
  @checkers ||= Set.new
end

Instance Method Details

#enabled_checkersArray<Class>

Returns:

  • (Array<Class>)


36
37
38
# File 'lib/database_consistency/processors/base_processor.rb', line 36

def enabled_checkers
  self.class.checkers.select { |checker| checker.enabled?(configuration) }
end

#reports(catch_errors: true) ⇒ Array<Hash>

Returns:

  • (Array<Hash>)


26
27
28
29
30
31
32
33
# File 'lib/database_consistency/processors/base_processor.rb', line 26

def reports(catch_errors: true)
  @reports ||= check
rescue StandardError => e
  raise e unless catch_errors

  RescueError.call(e)
  []
end