Method: Zip::InputStream.open

Defined in:
lib/zip/input_stream.rb

.open(filename) ⇒ Object

Same as #initialize but if a block is passed the opened stream is passed to the block and closed when the block returns.



68
69
70
71
72
73
74
75
# File 'lib/zip/input_stream.rb', line 68

def InputStream.open(filename)
  return new(filename) unless block_given?
  
  zio = new(filename)
  yield zio
ensure
  zio.close if zio
end