Module: Olyx::Guardrails::Notification::Preview

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

Overview

Produces a bounded redacted preview with a truncation marker.

Constant Summary collapse

LENGTH =
300

Class Method Summary collapse

Class Method Details

.call(value, scrubber) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/olyx/guardrails/notification/preview.rb', line 12

def call(value, scrubber)
  source = value.to_s
  scrubbed = scrubber.call(source)
  preview = scrubbed[0...LENGTH]
  preview += '' if truncated?(source, scrubbed)
  preview
end