Class: Lepus::Consumers::Worker
- Inherits:
-
Processes::Base
- Object
- Processes::Base
- Lepus::Consumers::Worker
- Extended by:
- Forwardable
- Includes:
- Processes::Runnable, Web::WorkerExtensions
- Defined in:
- lib/lepus/consumers/worker.rb
Instance Attribute Summary collapse
-
#definer ⇒ Object
readonly
Returns the value of attribute definer.
Attributes inherited from Processes::Base
Instance Method Summary collapse
- #after_fork ⇒ Object
- #before_fork ⇒ Object
-
#initialize(definer, **options) ⇒ Worker
constructor
A new instance of Worker.
- #metadata ⇒ Object
Methods included from Processes::Runnable
Methods included from Processes::Supervised
Methods inherited from Processes::Base
Methods included from Processes::Procline
Methods included from Processes::Interruptible
Methods included from Processes::Registrable
Methods included from AppExecutor
#handle_thread_error, #wrap_in_app_executor
Methods included from Processes::Callbacks
Constructor Details
#initialize(definer, **options) ⇒ Worker
Returns a new instance of Worker.
16 17 18 19 20 |
# File 'lib/lepus/consumers/worker.rb', line 16 def initialize(definer, **) @definer = definer super(**) end |
Instance Attribute Details
#definer ⇒ Object (readonly)
Returns the value of attribute definer.
14 15 16 |
# File 'lib/lepus/consumers/worker.rb', line 14 def definer @definer end |
Instance Method Details
#after_fork ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lepus/consumers/worker.rb', line 38 def after_fork consumers.each do |consumer_class| next unless consumer_class.respond_to?(:after_fork, true) warn "[DEPRECATION] #{consumer_class}.after_fork is deprecated and will be removed in Lepus 0.0.1. Use the process-level after_fork hook instead." consumer_class.send(:after_fork) end definer.run_process_callbacks(:after_fork) end |
#before_fork ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/lepus/consumers/worker.rb', line 26 def before_fork consumers.each do |consumer_class| next unless consumer_class.respond_to?(:before_fork, true) warn "[DEPRECATION] #{consumer_class}.before_fork is deprecated and will be removed in Lepus 0.0.1. Use the process-level before_fork hook instead." consumer_class.send(:before_fork) end definer.run_process_callbacks(:before_fork) end |
#metadata ⇒ Object
22 23 24 |
# File 'lib/lepus/consumers/worker.rb', line 22 def super.merge(name: name, consumers: consumers.map(&:to_s)) end |