class ProcessExecuter::Destinations::MonitoredPipe
Handles monitored pipes
@api private
Public Class Methods
handles?(destination)
click to toggle source
Determines if this class can handle the given destination
@param destination [Object] the destination to check @return [Boolean] true if destination is a ProcessExecuter::MonitoredPipe
# File lib/process_executer/destinations/monitored_pipe.rb, line 39 def self.handles?(destination) destination.is_a? ProcessExecuter::MonitoredPipe end
Public Instance Methods
close()
click to toggle source
Closes the pipe if it’s open
@return [void]
# File lib/process_executer/destinations/monitored_pipe.rb, line 31 def close destination.close if destination.state == :open end
write(data)
click to toggle source
Writes data to the monitored pipe
@example
stringio_dest = StringIO.new pipe = ProcessExecuter::MonitoredPipe.new(stringio_dest) pipe_handler = ProcessExecuter::Destinations::MonitoredPipe.new(pipe) pipe_handler.write("Data to pipe")
@param data [String] the data to write
@return [Integer] the number of bytes written
Calls superclass method
ProcessExecuter::Destinations::DestinationBase#write
# File lib/process_executer/destinations/monitored_pipe.rb, line 23 def write(data) super destination.write data end