Sha256: 0a5dcd232bb738ed9733c7d345135ac1c20ec28fcdfbc3c4faef0d58f9359115

Contents?: true

Size: 861 Bytes

Versions: 11

Compression:

Stored size: 861 Bytes

Contents

module NotificationPusher
    class Pusher

        attr_accessor :name
        attr_accessor :options
        attr_accessor :instances

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

        def push notification, options = {}
            default_options = self.options
            options = options.nil? ? default_options : default_options.merge!(options)
            if defined?(NotificationPusher.const_get(self.name))
                instance = NotificationPusher.const_get(self.name).new notification, options
                self.instances << instance
            end
        end

        def self.find_by_name name
            NotificationPusher.configuration.pushers.select { |pusher| pusher.name == name }
        end

    end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
notification-pusher-1.2.5 lib/notification_pusher/pusher.rb
notification-pusher-1.2.4 lib/notification_pusher/pusher.rb
notification-pusher-1.2.3 lib/notification_pusher/pusher.rb
notification-pusher-1.2.2 lib/notification_pusher/pusher.rb
notification-pusher-1.2.1 lib/notification_pusher/pusher.rb
notification-pusher-1.2.0 lib/notification_pusher/pusher.rb
notification-pusher-1.1.2 lib/notification_pusher/pusher.rb
notification-pusher-1.1.1 lib/notification_pusher/pusher.rb
notification-pusher-1.1.0 lib/notification_pusher/pusher.rb
notification-pusher-1.0.0 lib/notification_pusher/pusher.rb
notification-pusher-1.0.0.beta11 lib/notification_pusher/pusher.rb