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
155 156 157 |
# File 'lib/dry/events/publisher.rb', line 155 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
162 163 164 |
# File 'lib/dry/events/publisher.rb', line 162 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
148 149 150 |
# File 'lib/dry/events/publisher.rb', line 148 def new_bus Bus.new(events: events.dup, listeners: listeners.dup) end |