Class: EvilEvents::Core::Events::Notifier::Sequential Private

Inherits:
Abstract
  • Object
show all
Includes:
Logging
Defined in:
lib/evil_events/core/events/notifier/sequential.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.3.0

Instance Method Summary collapse

Methods included from Logging

#log_activity, #log_failure, #log_success

Methods inherited from Abstract

#initialize, #restart!, #shutdown!

Constructor Details

This class inherits a constructor from EvilEvents::Core::Events::Notifier::Abstract

Instance Method Details

#notify(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.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/evil_events/core/events/notifier/sequential.rb', line 17

def notify(manager, event)
  errors_stack = EvilEvents::FailingSubscribersError.new

  event.__call_before_hooks__

  manager.subscribers.each do |subscriber|
    begin
      subscriber.notify(event)

      log_success(event, subscriber)
    rescue StandardError => error
      log_failure(event, subscriber)

      event.__call_on_error_hooks__(error)

      errors_stack << error
    end
  end

  event.__call_after_hooks__

  raise errors_stack unless errors_stack.empty?
end