Class: Mabmapper::TarWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/mabmapper/tar_writer.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ TarWriter

Returns a new instance of TarWriter.



8
9
10
# File 'lib/mabmapper/tar_writer.rb', line 8

def initialize(io)
  @tar_writer = Gem::Package::TarWriter.new(io)
end

Class Method Details

.out_file(output_dir_name, file_name, options = {}) ⇒ Object



4
5
6
# File 'lib/mabmapper/tar_writer.rb', line 4

def self.out_file(output_dir_name, file_name, options = {})
  File.join(output_dir_name, File.basename(file_name))
end

Instance Method Details

#add_file(name, mode) ⇒ Object

:yields: io



12
13
14
15
16
# File 'lib/mabmapper/tar_writer.rb', line 12

def add_file(name, mode) # :yields: io
  @tar_writer.add_file(name, mode) do |f|
    yield f
  end
end

#add_file_simple(name, mode, size) ⇒ Object

:yields: io



18
19
20
21
22
# File 'lib/mabmapper/tar_writer.rb', line 18

def add_file_simple(name, mode, size) # :yields: io
  @tar_writer.add_file_simple(name, mode, size) do |f|
    yield f
  end
end

#closeObject



24
25
26
# File 'lib/mabmapper/tar_writer.rb', line 24

def close
  @tar_writer.close
end