Module: Olyx::Guardrails::Risk::DeterministicScore

Defined in:
lib/olyx/guardrails/risk/deterministic_score.rb

Overview

Computes the bounded score contributed by deterministic checks.

Class Method Summary collapse

Class Method Details

.call(checks, ordered_checks) ⇒ Object



12
13
14
15
16
# File 'lib/olyx/guardrails/risk/deterministic_score.rb', line 12

def call(checks, ordered_checks)
  score = CheckWeights.call(checks)
  score += BLOCKED_RISK_WEIGHT if ordered_checks.any? { |check| !check[:allowed] }
  score.clamp(0.0, 1.0).round(4)
end