Sha256: 43048b0885a2328d0d12a45fd5f155da5657e0c8ceb4c94f5f78c486227fb653

Contents?: true

Size: 878 Bytes

Versions: 23

Compression:

Stored size: 878 Bytes

Contents

module Errdo
  # rubocop:disable MutableConstant
  EXTENSIONS = []
  AUTHORIZATION_ADAPTERS = {}
  NOTIFICATION_ADAPTERS = {}
  # rubocop:enable MutableConstant

  # The extension may define various adapters (e.g., for authorization) and
  # register those via the options hash.
  def self.add_extension(extension_key, extension_definition, options = {})
    options.assert_valid_keys(:authorization)

    EXTENSIONS << extension_key

    if options[:authorization]
      AUTHORIZATION_ADAPTERS[extension_key] = extension_definition::AuthorizationAdapter
    end
  end

  def self.add_notification(notification_key, notification_definition, options = {})
    options.assert_valid_keys(:notification)

    EXTENSIONS << notification_key

    if options[:notification]
      NOTIFICATION_ADAPTERS[notification_key] = notification_definition::NotificationAdapter
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
errdo-0.12.14 lib/errdo/extension.rb
errdo-0.12.13 lib/errdo/extension.rb
errdo-0.12.12 lib/errdo/extension.rb
errdo-0.12.11 lib/errdo/extension.rb
errdo-0.12.10 lib/errdo/extension.rb
errdo-0.12.9 lib/errdo/extension.rb
errdo-0.12.8 lib/errdo/extension.rb
errdo-0.12.7 lib/errdo/extension.rb
errdo-0.12.6 lib/errdo/extension.rb
errdo-0.12.5 lib/errdo/extension.rb
errdo-0.12.4 lib/errdo/extension.rb
errdo-0.12.3 lib/errdo/extension.rb
errdo-0.12.2 lib/errdo/extension.rb
errdo-0.12.1 lib/errdo/extension.rb
errdo-0.12.0 lib/errdo/extension.rb
errdo-0.11.6 lib/errdo/extension.rb
errdo-0.11.5 lib/errdo/extension.rb
errdo-0.11.4 lib/errdo/extension.rb
errdo-0.11.3 lib/errdo/extension.rb
errdo-0.11.2 lib/errdo/extension.rb