Module: Olyx::Guardrails::Pii::BlockScrubber

Defined in:
lib/olyx/guardrails/pii/block_scrubber.rb

Overview

Redacts a text content block while preserving its Hash shape.

Class Method Summary collapse

Class Method Details

.call(block) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/olyx/guardrails/pii/block_scrubber.rb', line 13

def call(block)
  return [block, false] unless block.is_a?(Hash)

  key = HashKey.call(block, 'text')
  text = block[key] if key
  return [block, false] unless text.is_a?(String)

  result(block, key, text, TextScrubber.call(text))
end