Module: CodexNotify::DestinationName

Defined in:
lib/codex_notify/destination_name.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

PATTERN =
/\A[A-Z0-9_]+\z/

Class Method Summary collapse

Class Method Details

.normalize(value) ⇒ Object

Raises:



11
12
13
14
15
16
# File 'lib/codex_notify/destination_name.rb', line 11

def normalize(value)
  normalized = value.to_s.strip.upcase
  return normalized if PATTERN.match?(normalized)

  raise Error, 'destination must contain only A-Z, 0-9, and _'
end