Class: Watcher::Process
- Inherits:
-
BasicWatcher
- Object
- BasicWatcher
- Watcher::Process
- Defined in:
- lib/informer/watcher/process.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#process ⇒ Object
readonly
Returns the value of attribute process.
Attributes inherited from BasicWatcher
Instance Method Summary collapse
-
#initialize(command, options = {}, &block) ⇒ Process
constructor
A new instance of Process.
- #report ⇒ Object
- #running? ⇒ Boolean
Constructor Details
#initialize(command, options = {}, &block) ⇒ Process
Returns a new instance of Process.
6 7 8 9 10 |
# File 'lib/informer/watcher/process.rb', line 6 def initialize(command, = {}, &block) @custom_message = block if block_given? @command = command @handle = [:handle] || command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
4 5 6 |
# File 'lib/informer/watcher/process.rb', line 4 def command @command end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
4 5 6 |
# File 'lib/informer/watcher/process.rb', line 4 def handle @handle end |
#process ⇒ Object (readonly)
Returns the value of attribute process.
4 5 6 |
# File 'lib/informer/watcher/process.rb', line 4 def process @process end |
Instance Method Details
#report ⇒ Object
12 13 14 15 |
# File 'lib/informer/watcher/process.rb', line 12 def report return @custom_message.call(self) if @custom_message "#{@handle} is #{running? ? '' : 'not '}running" end |
#running? ⇒ Boolean
17 18 19 |
# File 'lib/informer/watcher/process.rb', line 17 def running? process_matcher === processes end |