Class: Recheck::Reporter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/recheck/reporters.rb

Direct Known Subclasses

Cron, Default, Json, Silent

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg:) ⇒ Base

Returns a new instance of Base.



19
20
# File 'lib/recheck/reporters.rb', line 19

def initialize(arg:)
end

Class Attribute Details

.subclassesObject (readonly)

Returns the value of attribute subclasses.



8
9
10
# File 'lib/recheck/reporters.rb', line 8

def subclasses
  @subclasses
end

Class Method Details

.helpObject



16
17
# File 'lib/recheck/reporters.rb', line 16

def self.help
end

.inherited(subclass) ⇒ Object



10
11
12
13
# File 'lib/recheck/reporters.rb', line 10

def inherited(subclass)
  super
  @subclasses << subclass
end

Instance Method Details

#around_check(checker:, query:, check:, record:) ⇒ Object



57
58
59
# File 'lib/recheck/reporters.rb', line 57

def around_check(checker:, query:, check:, record:)
  result = yield
end

#around_checker(checker:, queries: [], checks: []) ⇒ Object



49
50
51
# File 'lib/recheck/reporters.rb', line 49

def around_checker(checker:, queries: [], checks: [])
  counts = yield
end

#around_query(checker:, query:, checks: []) ⇒ Object



53
54
55
# File 'lib/recheck/reporters.rb', line 53

def around_query(checker:, query:, checks: [])
  yield
end

#around_run(checkers: []) ⇒ Object

A recheck run flows like this, with indicated calls to each reporter.

around_run -> for each Checker class:

around_checker ->
  around_query ->
    run each query() method
    for each 'check_' method on the checker:
      for each record queried:
        around_check ->
          check(record)


45
46
47
# File 'lib/recheck/reporters.rb', line 45

def around_run(checkers: [])
  total_count = yield
end

#fetch_record_id(record) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/recheck/reporters.rb', line 22

def fetch_record_id(record)
  if Recheck.unloaded_is_a? record, "ActiveRecord::Base"
    record.id.to_s
    # or: record.to_global_id, if you want to override in
    # your_app/recheck/reporter/base_reporter.rb
  elsif Recheck.unloaded_is_a? record, "Sequel::Model"
    record.pk.to_s # may be an array
  else
    record.to_s
  end
end

#halt(checker:, query:, error:, check: nil) ⇒ Object



61
62
63
# File 'lib/recheck/reporters.rb', line 61

def halt(checker:, query:, error:, check: nil)
  # running the checker was halted, so there's no result available for yield
end