Class: FastExists::Intelligence::Auditor

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_exists/intelligence/auditor.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.auditObject



6
7
8
# File 'lib/fast_exists/intelligence/auditor.rb', line 6

def self.audit
  new.run_audit
end

Instance Method Details

#run_auditObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fast_exists/intelligence/auditor.rb', line 10

def run_audit
  findings = []

  # 1. Inspect ActiveRecord Models & Indexes
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.descendants.reject(&:abstract_class?).each do |klass|
      next unless klass.respond_to?(:table_exists?) && klass.table_exists?
      inspect_model(klass, findings)
    end
  end

  # 2. Inspect Backend Configuration
  inspect_configuration(findings)

  # 3. Calculate Audit Score & Grade
  score = calculate_audit_score(findings)
  grade = determine_grade(score)

  {
    audit_score: score,
    grade: grade,
    findings: findings
  }
end