Module: Compass::Notification

Defined in:
lib/compass/notification.rb,
lib/compass/notification/provider.rb

Defined Under Namespace

Classes: Provider

Class Method Summary collapse

Class Method Details

.build(context) ⇒ Array<Compass::Notification::Provider>

Returns all notification providers for the given context.

Parameters:

  • context (Hash)

    the context to pass to the notification providers

Returns:



9
10
11
12
13
14
15
16
17
# File 'lib/compass/notification.rb', line 9

def self.build(context)
  Compass.config.notification.providers.filter_map do |provider|
    provider_class = provider.try(:constantize) || provider
    provider_class.new(**context)
  rescue => e
    Compass.logger&.error("[ Compass::Notification::Provider ] #{provider}: #{e.class}: #{e.message}")
    nil
  end
end