Sha256: fee8b60de8ee1142f7bfba3417b9bbdb307b3b402700793910065adb6f96a701

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

module NotificationPusher
  class Pusher
    attr_reader :name

    def initialize(name, options = {})
      @instances = []
      @name = name
      @options = options
    end

    def push(notification, options = {})
      options = @options.merge!(options)

      return unless defined?(NotificationPusher.const_get(@name))
      instance = NotificationPusher.const_get(@name).new(notification, options)
      @instances << instance
    end

    def self.find_by_name(name)
      NotificationPusher.configuration.pushers.select do |pusher|
        pusher.name == name
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
notification-pusher-1.2.6 lib/notification_pusher/pusher.rb