Class: GZippedTar::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/gzipped_tar/writer.rb

Instance Method Summary collapse

Instance Method Details

#add(path, contents) ⇒ Object



8
9
10
# File 'lib/gzipped_tar/writer.rb', line 8

def add(path, contents)
  writer.add_file(path, 0o644) { |input| input.write contents }
end

#outputObject



12
13
14
15
16
17
18
19
20
# File 'lib/gzipped_tar/writer.rb', line 12

def output
  io = binary_io

  gzip_writer = Zlib::GzipWriter.new io
  gzip_writer.write input_io.string
  gzip_writer.close

  io.string
end