Module: CentralNotifications

Defined in:
lib/notifier.rb,
lib/registration.rb,
lib/central_notifications.rb

Defined Under Namespace

Classes: Notifier, Registration

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/central_notifications.rb', line 12

def self.included(klass)
  class << klass
    def register_for_notification
      notifier = Notifier.instance
      notifier.register do |registration, notification|
        notification.klass = self
        yield registration, notification
      end
    end
  end
  
end

.notifyObject



5
6
7
8
9
10
# File 'lib/central_notifications.rb', line 5

def self.notify
  notifier = Notifier.instance
  notifier.register do |registration, notification|
    yield registration, notification
  end
end