Module: Dry::Events::Publisher::ClassMethods
- Defined in:
- lib/dry/events/publisher.rb
Overview
Class interface for publisher classes
Instance Method Summary collapse
-
#events ⇒ Object
private
Global registry with events.
-
#listeners ⇒ Object
private
Global registry with listeners.
-
#new_bus ⇒ Bus
private
Sets up event bus for publisher instances.
-
#register_event(event_id, payload = EMPTY_HASH) ⇒ Object
Register an event.
-
#subscribe(event_id, filter_hash = EMPTY_HASH, &block) ⇒ Class
Subscribe to an event.
Instance Method Details
#events ⇒ Object
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.
Global registry with events
170 171 172 |
# File 'lib/dry/events/publisher.rb', line 170 def events @__events__ ||= Concurrent::Map.new end |
#listeners ⇒ Object
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.
Global registry with listeners
177 178 179 |
# File 'lib/dry/events/publisher.rb', line 177 def listeners @__listeners__ ||= LISTENERS_HASH.dup end |
#new_bus ⇒ Bus
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.
Sets up event bus for publisher instances
163 164 165 |
# File 'lib/dry/events/publisher.rb', line 163 def new_bus Bus.new(events: events.dup, listeners: listeners.dup) end |