Module: Olyx::Guardrails::Notification::Key

Defined in:
lib/olyx/guardrails/notification/key.rb

Overview

Normalizes a redacted metadata key.

Constant Summary collapse

LENGTH =
50

Class Method Summary collapse

Class Method Details

.call(value, scrubber) ⇒ Object



12
13
14
15
# File 'lib/olyx/guardrails/notification/key.rb', line 12

def call(value, scrubber)
  normalized = scrubber.call(value).gsub(/[^A-Za-z0-9_.-]/, '_')[0...LENGTH]
  normalized.empty? ? 'metadata' : normalized
end