class Rocketman::Event

Public Class Methods

new(event, payload) click to toggle source
# File lib/rocketman/event.rb, line 3
def initialize(event, payload)
  @event = event
  @payload = payload
  Rocketman::Registry.register_event(event)
end

Public Instance Methods

notify_consumers() click to toggle source
# File lib/rocketman/event.rb, line 9
def notify_consumers
  consumers = Rocketman::Registry.get_consumers_for(@event)

  return if consumers.nil? || consumers.empty?

  consumers.each do |consumer, action|
    consumer.instance_exec(@payload, &action)
  end
end