Class: EvilEvents::Core::Broadcasting::Emitter Private
- Inherits:
-
Object
- Object
- EvilEvents::Core::Broadcasting::Emitter
- Defined in:
- lib/evil_events/core/broadcasting/emitter.rb,
lib/evil_events/core/broadcasting/emitter/adapter_proxy.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: AdapterProxy
Instance Method Summary collapse
- #emit(event, adapter: nil) ⇒ void private
- #log_activity(event, adapter_proxy) ⇒ void private private
- #raw_emit(event_type, id: nil, payload: {}, metadata: {}, adapter: nil) ⇒ void private
Instance Method Details
#emit(event, adapter: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/evil_events/core/broadcasting/emitter.rb', line 13 def emit(event, adapter: nil) unless event.is_a?(EvilEvents::Core::Events::AbstractEvent) raise EvilEvents::IncorrectEventForEmitError end adapter_proxy = AdapterProxy.new(event, explicit_identifier: adapter) log_activity(event, adapter_proxy) adapter_proxy.broadcast! end |
#log_activity(event, adapter_proxy) ⇒ void (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
47 48 49 50 51 52 53 54 55 |
# File 'lib/evil_events/core/broadcasting/emitter.rb', line 47 def log_activity(event, adapter_proxy) activity = "EventEmitted(#{adapter_proxy.identifier})" = "ID: #{event.id} :: " \ "TYPE: #{event.type} :: " \ "PAYLOAD: #{event.payload} :: " \ "METADATA: #{event.}" EvilEvents::Core::ActivityLogger.log(activity: activity, message: ) end |
#raw_emit(event_type, id: nil, payload: {}, metadata: {}, adapter: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
32 33 34 35 36 37 38 |
# File 'lib/evil_events/core/broadcasting/emitter.rb', line 32 def raw_emit(event_type, id: nil, payload: {}, metadata: {}, adapter: nil) event_object = EvilEvents::Core::Bootstrap[:event_system].resolve_event_object( event_type, id: id, payload: payload, metadata: ) emit(event_object, adapter: adapter) end |