Sha256: cfdd0aa7358bdb8fdcb953b8f487e3a2e84aefe236b5d1f852858b068f42ef58

Contents?: true

Size: 729 Bytes

Versions: 11

Compression:

Stored size: 729 Bytes

Contents

module NotificationHandler
    module Target

        def self.included base
            base.extend ClassMethods
        end

        module ClassMethods
            def notification_target
                has_many :notifications, as: :target, dependent: :destroy
                include NotificationHandler::Target::InstanceMethods

                include NotificationSettings::Target if defined?(NotificationSettings)
                include NotificationSettings::Subscriber if defined?(NotificationSettings)
            end
        end

        module InstanceMethods

            def notify options = {}
                self.notifications.create options
            end

        end

    end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
notification-handler-1.2.5 lib/notification_handler/target.rb
notification-handler-1.2.4 lib/notification_handler/target.rb
notification-handler-1.2.3 lib/notification_handler/target.rb
notification-handler-1.2.2 lib/notification_handler/target.rb
notification-handler-1.2.1 lib/notification_handler/target.rb
notification-handler-1.2.0 lib/notification_handler/target.rb
notification-handler-1.1.2 lib/notification_handler/target.rb
notification-handler-1.1.1 lib/notification_handler/target.rb
notification-handler-1.1.0 lib/notification_handler/target.rb
notification-handler-1.0.0 lib/notification_handler/target.rb
notification-handler-1.0.0.beta11 lib/notification_handler/target.rb