Class: Proclib::CommandMonitor

Inherits:
Object
  • Object
show all
Defined in:
lib/proclib/command_monitor.rb

Overview

Watches the given command, emitting the appropriate events on the given channel when the command does something

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, channel:) ⇒ CommandMonitor



9
10
11
# File 'lib/proclib/command_monitor.rb', line 9

def initialize(command, channel:)
  @command, @channel = command, channel
end

Instance Attribute Details

#channelObject (readonly)

Returns the value of attribute channel.



7
8
9
# File 'lib/proclib/command_monitor.rb', line 7

def channel
  @channel
end

#commandObject (readonly)

Returns the value of attribute command.



7
8
9
# File 'lib/proclib/command_monitor.rb', line 7

def command
  @command
end

Instance Method Details

#startObject



13
14
15
# File 'lib/proclib/command_monitor.rb', line 13

def start
  io_handlers.each(&:start)
end

#waitObject



17
18
19
# File 'lib/proclib/command_monitor.rb', line 17

def wait
  io_handlers.each(&:wait)
end