Module: Dallal::Events::Publisher::ClassMethods

Defined in:
lib/dallal/events/publisher.rb

Instance Method Summary collapse

Instance Method Details

#broadcast(info) ⇒ Object

Broadcast to dallals



28
29
30
# File 'lib/dallal/events/publisher.rb', line 28

def broadcast(info)
  ActiveSupport::Notifications.instrument(self.pub_sub_namespace, info)
end

#broadcast_event(name, payload = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/dallal/events/publisher.rb', line 32

def broadcast_event(name, payload = {})
  if block_given?
    ActiveSupport::Notifications.instrument(name, payload) do
      yield
    end
  else
    ActiveSupport::Notifications.instrument(name, payload)
  end
end