Module: Olyx::Guardrails::Redaction::PublicResult

Defined in:
lib/olyx/guardrails/redaction/public_result.rb

Overview

Presents the stable public redaction result contract.

Constant Summary collapse

CONTENT_FIELDS =
%i[pii_detected secret_leaked policy_violated policy_findings findings].freeze

Class Method Summary collapse

Class Method Details

.call(source, content, policy) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/olyx/guardrails/redaction/public_result.rb', line 12

def call(source, content, policy)
  text = content[:text]
  content.slice(*CONTENT_FIELDS).merge(
    text: text,
    redacted: text != source,
    policy_name: policy.name
  )
end