class Notifi::Subscription

Public Instance Methods

notification_class(event) click to toggle source
# File lib/notifi/subscription.rb, line 28
def notification_class(event)
  subscribable_options[event] || subscribable_options[:default] || Notification
end
notify(event=:default, notifier: nil, set: {}) click to toggle source
# File lib/notifi/subscription.rb, line 10
def notify(event=:default, notifier: nil, set: {})
  # TODO I wanted to do this in the subscribable notify method so you could
  # still forceably notifiy the notifier, but for the life of me I couldn't
  # get it to work.
  if notifier != self.subscriber
    set[:subscription] = self
    set[:notifier] = notifier
    set[:subscriber] = self.subscriber
    set[:subscribable] = self.subscribable

    self.notification_class(event).create(set)
  end
end
subscribable_options() click to toggle source
# File lib/notifi/subscription.rb, line 24
def subscribable_options
  self.subscribable.subscribable_options
end