Method: Zip::ZipOutputStream.open

Defined in:
lib/zip/zip.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.



934
935
936
937
938
939
940
# File 'lib/zip/zip.rb', line 934

def ZipOutputStream.open(fileName)
  return new(fileName) unless block_given?
  zos = new(fileName)
  yield zos
ensure
  zos.close if zos
end