Class: OBF::Utils::Zipper
- Inherits:
-
Object
- Object
- OBF::Utils::Zipper
- Defined in:
- lib/obf/utils.rb
Instance Method Summary collapse
- #add(path, contents) ⇒ Object
-
#initialize(zipfile) ⇒ Zipper
constructor
A new instance of Zipper.
- #read(path) ⇒ Object
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 |