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.
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/zip/file.rb', line 95 def open(file_name, create = nil) zf = ::Zip::File.new(file_name, create) return zf unless block_given? begin yield zf zf ensure zf.close end end |