Sha256: d289f998ff55d32401278d854eba52ae243a15ec973b0111e84d803f2ea534c7
Contents?: true
Size: 903 Bytes
Versions: 1
Compression:
Stored size: 903 Bytes
Contents
# frozen_string_literal: true module Stenotype # # {Stenotype::Dispatcher} is responsible for gluing together # publishing targets and data gathering. # class Dispatcher # # Publishes an event to the list of configured targets. # # @example # # event = Stenotype::Event.new(data, options, eval_context) # Stenotype::Dispatcher.new.publish(event) # # @param event {Stenotype::Event} An instance of event to be published. # @param serializer {#serialize} A class responsible for serializing the event # @return {Stenotype::Dispatcher} for the sake of chaining # def publish(event, serializer: Stenotype::EventSerializer) event_data = serializer.new(event).serialize targets.each do |t| t.publish(event_data) end self end private def targets Stenotype.config.targets end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stenotype-0.1.0 | lib/stenotype/dispatcher.rb |