Class: EvilEvents::Core::Events::Notifier::Worker Private
- Extended by:
- Forwardable
- Defined in:
- lib/evil_events/core/events/notifier/worker.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.
Defined Under Namespace
Constant Summary collapse
- MAIN_THREAD_POLICY =
:main_thread
- IGNORANCE_POLICY =
:ignorance
- EXCEPTION_POLICY =
:exception
Instance Attribute Summary collapse
- #executor ⇒ EvilEvents::Core::Events::Notifier::Worker::Executor readonly private
Instance Method Summary collapse
-
#initialize(min_threads:, max_threads:, max_queue:, fallback_policy: MAIN_THREAD_POLICY) ⇒ Worker
constructor
private
A new instance of Worker.
- #notify(manager, event) ⇒ Object private
- #schedule_job(event, subscriber) ⇒ Object private private
Methods inherited from Abstract
Constructor Details
#initialize(min_threads:, max_threads:, max_queue:, fallback_policy: MAIN_THREAD_POLICY) ⇒ Worker
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 Worker.
40 41 42 43 44 45 46 47 |
# File 'lib/evil_events/core/events/notifier/worker.rb', line 40 def initialize(min_threads:, max_threads:, max_queue:, fallback_policy: MAIN_THREAD_POLICY) @executor = Executor.new( min_threads: min_threads, max_threads: max_threads, max_queue: max_queue, fallback_policy: fallback_policy ) end |
Instance Attribute Details
#executor ⇒ EvilEvents::Core::Events::Notifier::Worker::Executor (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.
29 30 31 |
# File 'lib/evil_events/core/events/notifier/worker.rb', line 29 def executor @executor end |
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.
54 55 56 57 58 |
# File 'lib/evil_events/core/events/notifier/worker.rb', line 54 def notify(manager, event) event.__call_before_hooks__ manager.subscribers.each { |subscriber| schedule_job(event, subscriber) } event.__call_after_hooks__ end |
#schedule_job(event, subscriber) ⇒ Object (private)
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.
67 68 69 |
# File 'lib/evil_events/core/events/notifier/worker.rb', line 67 def schedule_job(event, subscriber) executor.execute(Job.new(event, subscriber)) end |