Sha256: a94de636429e8183a8d512094fac9e681e683fe98b75b76cdbe190edb7f6b863

Contents?: true

Size: 440 Bytes

Versions: 1

Compression:

Stored size: 440 Bytes

Contents

module Rocketman
  class Event
    def initialize(event, payload)
      @event = event
      @payload = payload
      @test = payload.fetch(:test, false)
      Rocketman::Registry.instance.register_event(event)
    end

    def notify_consumers
      consumers = Rocketman::Registry.instance.get_consumers_for(@event)

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rocketman-0.1.1 lib/rocketman/event.rb