class ProcessExecuter::Destinations::IO
Handles IO
objects
@api private
Public Class Methods
Source
# File lib/process_executer/destinations/io.rb, line 33 def self.handles?(destination) destination.is_a?(::IO) && destination.respond_to?(:fileno) && destination.fileno end
Determines if this class can handle the given destination
@param destination [Object] the destination to check @return [Boolean] true if destination is an IO
with a valid file descriptor
Public Instance Methods
Source
# File lib/process_executer/destinations/io.rb, line 24 def write(data) super destination.write data end
Writes data to the IO
object
@example
io = File.open('file.txt', 'w') io_handler = ProcessExecuter::Destinations::IO.new(io) io_handler.write("Hello world")
@param data [String] the data to write
@return [Integer] the number of bytes written
@raise [IOError] if the IO
object is closed
Calls superclass method
ProcessExecuter::Destinations::DestinationBase#write