Class: EvilEvents::Core::System::Broadcaster Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evil_events/core/system/broadcaster.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.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBroadcaster

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.

Returns a new instance of Broadcaster.

Since:

  • 0.1.0



23
24
25
26
27
28
29
# File 'lib/evil_events/core/system/broadcaster.rb', line 23

def initialize
  @adapters_container = EvilEvents::Core::Broadcasting::Adapters.new
  @event_emitter      = EvilEvents::Core::Broadcasting::Emitter.new
  @event_notifier     = EvilEvents::Core::Events::Notifier::Proxy.new

  @adapters_container.register_core_adapters!
end

Instance Attribute Details

#adapters_containerEvilEvents::Core::Broadcasting::Adapters (readonly)

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.



15
16
17
# File 'lib/evil_events/core/system/broadcaster.rb', line 15

def adapters_container
  @adapters_container
end

#event_emitterEvilEvents::Core::Broadcasting::Emitter (readonly)

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.

Returns:

Since:

  • 0.1.0



10
11
12
# File 'lib/evil_events/core/system/broadcaster.rb', line 10

def event_emitter
  @event_emitter
end

#event_notifierEvilEvents::Core::Events::Notifier::Abstract (readonly)

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.



20
21
22
# File 'lib/evil_events/core/system/broadcaster.rb', line 20

def event_notifier
  @event_notifier
end

Instance Method Details

#emit(event, adapter: nil) ⇒ 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.

Returns void.

Parameters:

Options Hash (adapter:):

  • (Symbol, NilClass)

Returns:

  • void

Since:

  • 0.1.0



36
37
38
# File 'lib/evil_events/core/system/broadcaster.rb', line 36

def emit(event, adapter: nil)
  event_emitter.emit(event, adapter: adapter)
end

#process_event_notification(manager, event) ⇒ 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.

Returns void.

Parameters:

Returns:

  • void

Since:

  • 0.3.0



76
77
78
# File 'lib/evil_events/core/system/broadcaster.rb', line 76

def process_event_notification(manager, event)
  event_notifier.notify(manager, event)
end

#raw_emit(event_type, id: nil, payload: {}, metadata: {}, adapter: nil) ⇒ 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.

Returns void.

Parameters:

  • event_type (String)
  • id (Hash) (defaults to: nil)

    a customizable set of options

  • payload (Hash) (defaults to: {})

    a customizable set of options

  • metadata (Hash) (defaults to: {})

    a customizable set of options

  • adapter (Hash) (defaults to: nil)

    a customizable set of options

Options Hash (id:):

  • (NilClass, String)

Options Hash (payload:):

  • (Hash)

Options Hash (metadata:):

  • (Hash)

Options Hash (adapter:):

  • (Symbol, NilClass)

Returns:

  • void

Since:

  • 0.1.0



48
49
50
51
52
# File 'lib/evil_events/core/system/broadcaster.rb', line 48

def raw_emit(event_type, id: nil, payload: {}, metadata: {}, adapter: nil)
  event_emitter.raw_emit(
    event_type, id: id, payload: payload, metadata: , adapter: adapter
  )
end

#register_adapter(adapter_name, adapter_object) ⇒ 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.

Returns void.

Parameters:

  • adapter_name (Symbol, String)
  • adapter_object (Object)

Returns:

  • void

Since:

  • 0.1.0



67
68
69
# File 'lib/evil_events/core/system/broadcaster.rb', line 67

def register_adapter(adapter_name, adapter_object)
  adapters_container.register(adapter_name, adapter_object)
end

#resolve_adapter(adapter_name) ⇒ EvilEvents::Core::Broadcasting::Dispatcher::Dispatchable

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.

Parameters:

  • adapter_name (Symbol, String)

Returns:

  • (EvilEvents::Core::Broadcasting::Dispatcher::Dispatchable)

Since:

  • 0.1.0



58
59
60
# File 'lib/evil_events/core/system/broadcaster.rb', line 58

def resolve_adapter(adapter_name)
  adapters_container.resolve(adapter_name)
end

#restart_event_notifierObject

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.

Returns void.

Returns:

  • void

Since:

  • 0.3.0



83
84
85
# File 'lib/evil_events/core/system/broadcaster.rb', line 83

def restart_event_notifier
  event_notifier.restart!
end