class Minitar::Output

Minitar::Output.new.
This notice applies to Minitar::Output.open, Minitar::Output.tar, and
* {CWE-088}[https://cwe.mitre.org/data/definitions/88.html]
* {CWE-078}[https://cwe.mitre.org/data/definitions/78.html]
* {CWE-073}[https://cwe.mitre.org/data/definitions/73.html]

that the output value is safe.
user to execute arbitrary system commands. It is the caller’s responsibility to ensure
a readable stream object. Using an untrusted value for output may allow a malicious
Constructing a Minitar::Output will use Kernel.open if the provided output is not
=== Security Notice
and Writer#mkdir are guaranteed to work.
stream provided to Output does not support random access, only Writer#add_file_simple
Wraps a Minitar::Writer with convenience methods and wrapped stream management. If the

def self.open(output)

Minitar::Output.open(io) { |output| block } -> obj
Minitar::Output.open(io) -> output
:call-seq:

closes the wrapped stream object). The return value will be the value of the block.
the Output object will automatically be closed when the block terminates (this also
If a block is given, the new Output will be yielded to the block as an argument and

With no associated block, +Output.open+ is a synonym for +Output.new+.
def self.open(output)
  stream = new(output)
  return stream unless block_given?
  # This exception context must remain, otherwise the stream closes on open
  # even if a block is not given.
  begin
    yield stream
  ensure
    stream.close
  end
end

def self.tar(output)

Minitar::Output.tar(io) { |tar| block } -> obj
Minitar::Output.tar(io) -> enumerator
:call-seq:

the same behaviour.
the Output object. If a block is not provided, an enumerator will be created with
Output.tar is a wrapper for Output.open that yields the owned tar object instead of
def self.tar(output)
  return to_enum(__method__, output) unless block_given?
  Output.open(output) do |stream|
    yield stream.tar
  end
end

def close

Closes the Writer object and the wrapped data stream.
def close
  @tar.close
  @io.close
end

def closed? = @io.closed?

Returns false if the wrapped data stream is open.
def closed? = @io.closed?

def initialize(output)

Minitar::Output.new(path) -> output
Minitar::Output.new(io) -> output
:call-seq:

Kernel#open. When Output#close is called, the stream object wrapped will be closed.
then it will simply be wrapped. Otherwise, one will be created and opened using
Creates a new Output object. If +output+ is a stream object that responds to #write,
def initialize(output)
  @io = if output.respond_to?(:write)
    output
  else
    ::Kernel.open(output, "wb")
  end
  @tar = Minitar::Writer.new(@io)
end