Method: Notifi::Subscription#notify

Defined in:
lib/notifi/subscription.rb

#notify(event = :default, notifier: nil, set: {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# 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