Method: Zip::File.open
- Defined in:
- lib/zip/file.rb
.open(file_name, create = nil) ⇒ Object
Same as #new. If a block is passed the ZipFile object is passed to the block and is automatically closed afterwards just as with ruby’s builtin File.open method.
98 99 100 101 102 103 104 105 106 |
# File 'lib/zip/file.rb', line 98 def open(file_name, create = nil) zf = ::Zip::File.new(file_name, create) return zf unless block_given? begin yield zf ensure zf.close end end |