Sha256: 054578290861a415d47ac33dc4a3076075b12fb70cd0d08d5ed45c6f6b4fcd49

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

module Emittance
  ##
  # Base class for event brokers.
  #
  class Broker
    DISPATCHER_KLASS_NAME = 'Dispatcher'

    class << self
      # @param _event [Emittance::Event] the event to be passed off to watchers
      def process_event(_event)
        raise NotImplementedError
      end

      def dispatcher
        const_get DISPATCHER_KLASS_NAME
      end

      def inherited(subklass)
        register_broker subklass
        super
      end

      def register_broker(broker)
        Emittance::Brokerage.register_broker broker
      end
    end
  end
end

require 'emittance/brokers/synchronous'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
emittance-0.0.4 lib/emittance/broker.rb