Class: Olyx::Guardrails::PiiScrubber
- Inherits:
-
Object
- Object
- Olyx::Guardrails::PiiScrubber
- Defined in:
- lib/olyx/guardrails/pii_scrubber.rb
Overview
Redacts documented PII formats from text and structured chat messages.
Detection is format-based and intentionally bounded. It is not a complete international PII taxonomy. See docs/OPERATIONS.md#pii for limitations.
Class Method Summary collapse
-
.scrub(text) ⇒ Object
:call-seq: PiiScrubber.scrub(text) -> String or object.
-
.scrub_messages(messages) ⇒ Object
:call-seq: PiiScrubber.scrub_messages(messages) -> Array.
-
.scrub_messages_with_detection(messages) ⇒ Object
:call-seq: PiiScrubber.scrub_messages_with_detection(messages) -> Hash.
Class Method Details
.scrub(text) ⇒ Object
:call-seq:
PiiScrubber.scrub(text) -> String or object
Returns a redacted String when text is a String. Non-String values are
returned unchanged.
18 19 20 |
# File 'lib/olyx/guardrails/pii_scrubber.rb', line 18 def self.scrub(text) Pii::TextScrubber.call(text) end |
.scrub_messages(messages) ⇒ Object
:call-seq:
PiiScrubber.scrub_messages(messages) -> Array
Returns a copy of messages with supported String content redacted.
Message and content-block key style is preserved. Raises ArgumentError
unless messages is an Array of Hashes.
28 29 30 |
# File 'lib/olyx/guardrails/pii_scrubber.rb', line 28 def self.() ()[:messages] end |
.scrub_messages_with_detection(messages) ⇒ Object
:call-seq:
PiiScrubber.scrub_messages_with_detection(messages) -> Hash
Redacts messages and returns both the transformed Array and a
:detected Boolean. Raises ArgumentError unless messages is an Array
of Hashes.
38 39 40 |
# File 'lib/olyx/guardrails/pii_scrubber.rb', line 38 def self.() Pii::MessageScrubber.call() end |