Module: Olyx::Guardrails::Redaction::InputValidator

Defined in:
lib/olyx/guardrails/redaction/input_validator.rb

Overview

Validates redaction policy type and configured length limit.

Class Method Summary collapse

Class Method Details

.call(source, policy) ⇒ Object

Raises:

  • (ArgumentError)


10
11
12
13
# File 'lib/olyx/guardrails/redaction/input_validator.rb', line 10

def call(source, policy)
  raise ArgumentError, 'policy must be an Olyx::Guardrails::Policy' unless policy.is_a?(Policy)
  raise ArgumentError, 'input exceeds max_input_length' if source.length > policy.max_input_length
end