Sha256: 2726287182b37ce90e074f2abafba595250da06e837d98869a666e54cb04aa95

Contents?: true

Size: 840 Bytes

Versions: 1

Compression:

Stored size: 840 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 = default_options.merge! options
            if defined?(NotificationPusher.const_get(pusher.name))
                instance = NotificationPusher.const_get(self.name).new notification, options
                self.instances << instance
            end
        end

        def self.find_by_name name
            ObjectSpace.each_object(NotificationPusher::Pusher).select { |pusher| pusher.name == name }
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
notification-pusher-1.0.0.beta10 lib/notification_pusher/pusher.rb