Sha256: 7adc33e9e7210b1e00bbe17c69f0ae3bae59936b76c2909ba7c711f50deea5d7

Contents?: true

Size: 762 Bytes

Versions: 2

Compression:

Stored size: 762 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

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

        module InstanceMethods

            def notify options = {}
                options[:target] = self
                Notification.create options
            end

        end

    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notification-handler-1.0.0.beta8 lib/notification_handler/target.rb
notification-handler-1.0.0.beta7 lib/notification_handler/target.rb