Wraps a Archive::Tar::Minitar::Writer with convenience methods and wrapped stream management; Output only works with random access data streams. See Output::new for details.
Creates a new Output object. If output is a stream object that responds to #), then it will simply be wrapped. Otherwise, one will be created and opened using Kernel#open. When Output#close is called, the stream object wrapped will be closed.
# File lib/archive/tar/minitar.rb, line 808 808: def initialize(output) 809: if output.respond_to?(:write) 810: @io = output 811: else 812: @io = ::File.open(output, "wb") 813: end 814: @tarwriter = Archive::Tar::Minitar::Writer.new(@io) 815: end
With no associated block, +Output::open+ is a synonym for +Output::new+. If the optional code block is given, it will be passed the new writer as an argument and the Output object will automatically be closed when the block terminates. In this instance, +Output::open+ returns the value of the block.
# File lib/archive/tar/minitar.rb, line 791 791: def self.open(output) 792: stream = Output.new(output) 793: return stream unless block_given? 794: 795: begin 796: res = yield stream 797: ensure 798: stream.close 799: end 800: 801: res 802: end
Closes the Writer object and the wrapped data stream.
# File lib/archive/tar/minitar.rb, line 823 823: def close 824: @tarwriter.close 825: @io.close 826: end
Returns the Writer object for direct access.
# File lib/archive/tar/minitar.rb, line 818 818: def tar 819: @tarwriter 820: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.