Method: Zip::InputStream.open
- Defined in:
- lib/zip/input_stream.rb
.open(filename_or_io, offset = 0, decrypter = nil) ⇒ Object
Same as #initialize but if a block is passed the opened stream is passed to the block and closed when the block returns.
95 96 97 98 99 100 101 102 103 |
# File 'lib/zip/input_stream.rb', line 95 def open(filename_or_io, offset = 0, decrypter = nil) zio = new(filename_or_io, offset, decrypter) return zio unless block_given? begin yield zio ensure zio.close if zio end end |