From f58e38012cf4d7493f70ffdc4e9a583d94f72ad5 Mon Sep 17 00:00:00 2001 From: Robert Haines Date: Sat, 19 Oct 2019 07:04:04 +0100 Subject: [PATCH 1/2] Add the `options` parameter to `Zip::File.open`. --- lib/zip/file.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/zip/file.rb b/lib/zip/file.rb index 9c7f3cbd..b6eec375 100644 --- a/lib/zip/file.rb +++ b/lib/zip/file.rb @@ -107,8 +107,8 @@ class << self # 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. - def open(file_name, create = false) - zf = ::Zip::File.new(file_name, create) + def open(file_name, create = false, options = {}) + zf = ::Zip::File.new(file_name, create, false, options) return zf unless block_given? begin yield zf From 3fea9958c2da24d16b20f545d982ad0c0a3d7f57 Mon Sep 17 00:00:00 2001 From: Robert Haines Date: Sat, 19 Oct 2019 07:15:51 +0100 Subject: [PATCH 2/2] Update comment for `Zip::File.open`. --- lib/zip/file.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/zip/file.rb b/lib/zip/file.rb index b6eec375..7c051bcd 100644 --- a/lib/zip/file.rb +++ b/lib/zip/file.rb @@ -104,9 +104,9 @@ def initialize(path_or_io, create = false, buffer = false, options = {}) end class << self - # 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. + # Similar to ::new. If a block is passed the Zip::File object is passed + # to the block and is automatically closed afterwards, just as with + # ruby's builtin File::open method. def open(file_name, create = false, options = {}) zf = ::Zip::File.new(file_name, create, false, options) return zf unless block_given?