Class: Olyx::Guardrails::Redactor

Inherits:
Object
  • Object
show all
Defined in:
lib/olyx/guardrails/redactor.rb

Overview

Applies the PII, secret, and restricted-policy transformation used by Olyx::Guardrails.redact.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input, policy) ⇒ Redactor

Returns a new instance of Redactor.



17
18
19
20
# File 'lib/olyx/guardrails/redactor.rb', line 17

def initialize(input, policy)
  @source = input.to_s
  @policy = policy
end

Class Method Details

.call(input, policy:) ⇒ Object



13
14
15
# File 'lib/olyx/guardrails/redactor.rb', line 13

def self.call(input, policy:)
  new(input, policy).call
end

Instance Method Details

#callObject



22
23
24
25
26
# File 'lib/olyx/guardrails/redactor.rb', line 22

def call
  Redaction::InputValidator.call(@source, @policy)
  content = PolicyAwareRedactor.call(@source, policy: @policy)
  Redaction::PublicResult.call(@source, content, @policy)
end