class ProcessExecuter::Destinations::Writer
Handles generic objects that respond to ‘#write`
@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 responds to write
and is not an IO
object with a fileno
# File lib/process_executer/destinations/writer.rb, line 33 def self.handles?(destination) destination.respond_to?(:write) && (!destination.respond_to?(:fileno) || destination.fileno.nil?) end
Public Instance Methods
write(data)
click to toggle source
Writes data to the destination object
@example
buffer = StringIO.new writer_handler = ProcessExecuter::Destinations::Writer.new(buffer) writer_handler.write("Hello world")
@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/writer.rb, line 22 def write(data) super destination.write data end