class ROM::Notifications::EventBus

Event bus

An event bus stores listeners (callbacks) and events

@api public

Attributes

events[R]

@!attribute [r] events

@return [Hash] A hash with events registered within a bus
id[R]

@!attribute [r] id

@return [Symbol] The bus identifier
listeners[R]

@!attribute [r] listeners

@return [Hash] A hash with event listeners registered within a bus

Public Class Methods

new(id, events: EMPTY_HASH, listeners: LISTENERS_HASH.dup) click to toggle source

Initialize a new event bus

@param [Symbol] id The bus identifier @param [Hash] events A hash with events @param [Hash] listeners A hash with listeners

@api public

# File lib/rom/support/notifications.rb, line 227
def initialize(id, events: EMPTY_HASH, listeners: LISTENERS_HASH.dup)
  @id = id
  @listeners = listeners
  @events = events
end