Module: Olyx::Guardrails::Notification::HandlerCollection

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

Overview

Validates and freezes named notification handlers.

Constant Summary collapse

MAXIMUM =
20

Class Method Summary collapse

Class Method Details

.call(handlers) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/olyx/guardrails/notification/handler_collection.rb', line 15

def call(handlers)
  HandlerCollectionValidator.input!(handlers, maximum: MAXIMUM)

  normalized = handlers.map { |name, handler| Handler.call(name, handler) }
  HandlerCollectionValidator.unique!(normalized)
  normalized.freeze
end