lib/io_streams/zip/reader.rb in iostreams-1.0.0.beta6 vs lib/io_streams/zip/reader.rb in iostreams-1.0.0.beta7
- old
+ new
@@ -30,9 +30,20 @@
ensure
zin&.close
fin&.close
end
+ def self.get_entry(zin, entry_file_name)
+ if entry_file_name.nil?
+ zin.get_next_entry
+ return true
+ end
+
+ while entry = zin.get_next_entry
+ return true if entry.name == entry_file_name
+ end
+ false
+ end
else
# Read from a zip file or stream, decompressing the contents as it is read
# The input stream from the first file found in the zip file is passed
# to the supplied block
def self.file(file_name, entry_file_name: nil, &block)