Module: Pidly::Callbacks
- Included in:
- Control
- Defined in:
- lib/pidly/callbacks.rb
Overview
Pidly before/after callbacks
Class Method Summary collapse
-
.included(receiver) ⇒ Object
Extend and include callback methods.
Instance Method Summary collapse
-
#after_stop(callback = nil) { ... } ⇒ Object
After stop.
-
#before_start(callback = nil) { ... } ⇒ Object
Before start.
-
#error(callback = nil) { ... } ⇒ Object
Error.
-
#kill(callback = nil) { ... } ⇒ Object
Kill.
-
#start(callback = nil) { ... } ⇒ Object
Start.
-
#stop(callback = nil) { ... } ⇒ Object
Stop.
Class Method Details
.included(receiver) ⇒ Object
Extend and include callback methods
133 134 135 |
# File 'lib/pidly/callbacks.rb', line 133 def self.included(receiver) receiver.extend self end |
Instance Method Details
#after_stop(callback = nil) { ... } ⇒ Object
After stop
Right after the daemon is instructed to stop the following callback will be invoked and executed.
75 76 77 |
# File 'lib/pidly/callbacks.rb', line 75 def after_stop(callback=nil, &block) add_callback(:after_stop, (callback || block)) end |
#before_start(callback = nil) { ... } ⇒ Object
Before start
Right before the daemon is instructed to start the following callback will be invoked and executed.
21 22 23 |
# File 'lib/pidly/callbacks.rb', line 21 def before_start(callback=nil, &block) add_callback(:before_start, (callback || block)) end |
#error(callback = nil) { ... } ⇒ Object
Error
If the daemon encounters an error or an exception is raised the following callback will be invoked and executed.
93 94 95 |
# File 'lib/pidly/callbacks.rb', line 93 def error(callback=nil, &block) add_callback(:error, (callback || block)) end |
#kill(callback = nil) { ... } ⇒ Object
Kill
Right before the kill instruction is sent the following callback will be invoked and executed.
111 112 113 |
# File 'lib/pidly/callbacks.rb', line 111 def kill(callback=nil, &block) add_callback(:kill, (callback || block)) end |
#start(callback = nil) { ... } ⇒ Object
Start
When the daemon is instructed to start the following callback will be invoked and executed.
39 40 41 |
# File 'lib/pidly/callbacks.rb', line 39 def start(callback=nil, &block) add_callback(:start, (callback || block)) end |
#stop(callback = nil) { ... } ⇒ Object
Stop
When the daemon is instructed to stop the following callback will be invoked and executed.
57 58 59 |
# File 'lib/pidly/callbacks.rb', line 57 def stop(callback=nil, &block) add_callback(:stop, (callback || block)) end |