Class: Daemonizer::Handler
- Inherits:
-
Object
- Object
- Daemonizer::Handler
- Defined in:
- lib/daemonizer/handler.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#worker_id ⇒ Object
Returns the value of attribute worker_id.
-
#workers_count ⇒ Object
Returns the value of attribute workers_count.
Instance Method Summary collapse
- #after_fork ⇒ Object
-
#initialize(handler_options = {}) ⇒ Handler
constructor
A new instance of Handler.
- #option(key) ⇒ Object
- #prepare(block) ⇒ Object
Constructor Details
#initialize(handler_options = {}) ⇒ Handler
Returns a new instance of Handler.
7 8 9 |
# File 'lib/daemonizer/handler.rb', line 7 def initialize( = {}) @handler_options = end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
5 6 7 |
# File 'lib/daemonizer/handler.rb', line 5 def logger @logger end |
#worker_id ⇒ Object
Returns the value of attribute worker_id.
3 4 5 |
# File 'lib/daemonizer/handler.rb', line 3 def worker_id @worker_id end |
#workers_count ⇒ Object
Returns the value of attribute workers_count.
4 5 6 |
# File 'lib/daemonizer/handler.rb', line 4 def workers_count @workers_count end |
Instance Method Details
#after_fork ⇒ Object
23 24 25 26 27 |
# File 'lib/daemonizer/handler.rb', line 23 def after_fork if block = option(:after_fork) block.call(Daemonizer.logger, @worker_id, @workers_count) end end |
#option(key) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/daemonizer/handler.rb', line 15 def option(key) if handler_option = @handler_options[key.to_sym] handler_option.value(self) else nil end end |
#prepare(block) ⇒ Object
11 12 13 |
# File 'lib/daemonizer/handler.rb', line 11 def prepare(block) block.call end |