Module: Olyx::Guardrails::Checks::PolicyCheck

Defined in:
lib/olyx/guardrails/checks/policy_check.rb

Overview

Presents named restricted-content matches as one policy check.

Class Method Summary collapse

Class Method Details

.call(source, policy) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/olyx/guardrails/checks/policy_check.rb', line 12

def call(source, policy)
  scan = PolicyScanner.scan(source, policy: policy)
  findings = scan[:findings]
  {
    type: 'policy',
    allowed: !scan[:blocked],
    violated: scan[:violated],
    count: findings.size,
    findings: findings
  }
end