class Stenotype::Dispatcher
{Stenotype::Dispatcher} is responsible for gluing together publishing targets and data gathering.
Public Instance Methods
publish(event, serializer: Stenotype::EventSerializer)
click to toggle source
Publishes an event to the list of configured targets.
@example Manually dispatching an event
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
# File lib/stenotype/dispatcher.rb, line 20 def publish(event, serializer: Stenotype::EventSerializer) event_data = serializer.new(event).serialize targets.each do |t| t.publish(event_data.to_json) end self end
Private Instance Methods
targets()
click to toggle source
# File lib/stenotype/dispatcher.rb, line 32 def targets Stenotype.config.targets end