Class: OBF::Utils::Zipper

Inherits:
Object
  • Object
show all
Defined in:
lib/obf/utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(zipfile) ⇒ Zipper

Returns a new instance of Zipper.



219
220
221
# File 'lib/obf/utils.rb', line 219

def initialize(zipfile)
  @zipfile = zipfile
end

Instance Method Details

#add(path, contents) ⇒ Object



223
224
225
# File 'lib/obf/utils.rb', line 223

def add(path, contents)
  @zipfile.get_output_stream(path) {|os| os.write contents }
end

#read(path) ⇒ Object



227
228
229
230
# File 'lib/obf/utils.rb', line 227

def read(path)
  entry = @zipfile.glob(path).first
  entry ? entry.get_input_stream.read : nil
end