class ProcessExecuter::Destinations::Tee
@api private
being the destinations.
The destination is an array with the first element being :tee and the rest
Handles destination for writing to multiple destinations
def self.handles?(destination)
-
(Boolean)- true if destination is an Array with path, mode, and permissions
Parameters:
-
destination(Object) -- the destination to check
def self.handles?(destination) destination.is_a?(Array) && destination.size > 1 && destination[0] == :tee end
def close
-
(void)-
def close child_destinations.each(&:close) end
def initialize(destination)
-
(ArgumentError)- if the mode is invalid -
(Errno::ENOENT)- if the file path is invalid
Returns:
-
(FilePathModePerms)- a new handler instance
Parameters:
-
destination(Array) -- array with file path, mode, and permissions
def initialize(destination) super @child_destinations = destination[1..].map { |dest| ProcessExecuter::Destinations.factory(dest) } end
def write(data)
-
(IOError)- if the file is closed
Returns:
-
(Integer)- the number of bytes written
Parameters:
-
data(String) -- the data to write
def write(data) super child_destinations.each { |dest| dest.write(data) } end