lib/zip_kit/streamer.rb in zip_kit-6.0.1 vs lib/zip_kit/streamer.rb in zip_kit-6.2.0
- old
+ new
@@ -167,11 +167,11 @@
# @param compressed_size [Integer] the size of the compressed entry that
# is going to be written into the archive
# @param uncompressed_size [Integer] the size of the entry when uncompressed, in bytes
# @param crc32 [Integer] the CRC32 checksum of the entry when uncompressed
# @param use_data_descriptor [Boolean] whether the entry body will be followed by a data descriptor
- # @param unix_permissions[Fixnum?] which UNIX permissions to set, normally the default should be used
+ # @param unix_permissions[Integer] which UNIX permissions to set, normally the default should be used
# @return [Integer] the offset the output IO is at after writing the entry header
def add_deflated_entry(filename:, modification_time: Time.now.utc, compressed_size: 0, uncompressed_size: 0, crc32: 0, unix_permissions: nil, use_data_descriptor: false)
add_file_and_write_local_header(filename: filename,
modification_time: modification_time,
crc32: crc32,
@@ -191,11 +191,11 @@
# @param filename [String] the name of the file in the entry
# @param modification_time [Time] the modification time of the file in the archive
# @param size [Integer] the size of the file when uncompressed, in bytes
# @param crc32 [Integer] the CRC32 checksum of the entry when uncompressed
# @param use_data_descriptor [Boolean] whether the entry body will be followed by a data descriptor. When in use
- # @param unix_permissions[Fixnum?] which UNIX permissions to set, normally the default should be used
+ # @param unix_permissions[Integer] which UNIX permissions to set, normally the default should be used
# @return [Integer] the offset the output IO is at after writing the entry header
def add_stored_entry(filename:, modification_time: Time.now.utc, size: 0, crc32: 0, unix_permissions: nil, use_data_descriptor: false)
add_file_and_write_local_header(filename: filename,
modification_time: modification_time,
crc32: crc32,
@@ -209,11 +209,11 @@
# Adds an empty directory to the archive with a size of 0 and permissions of 755.
#
# @param dirname [String] the name of the directory in the archive
# @param modification_time [Time] the modification time of the directory in the archive
- # @param unix_permissions[Fixnum?] which UNIX permissions to set, normally the default should be used
+ # @param unix_permissions[Integer] which UNIX permissions to set, normally the default should be used
# @return [Integer] the offset the output IO is at after writing the entry header
def add_empty_directory(dirname:, modification_time: Time.now.utc, unix_permissions: nil)
add_file_and_write_local_header(filename: dirname.to_s + "/",
modification_time: modification_time,
crc32: 0,
@@ -260,17 +260,16 @@
# So using this facility in async scenarios is certainly possible, but care
# and attention is recommended.
#
# @param filename[String] the name of the file in the archive
# @param modification_time [Time] the modification time of the file in the archive
- # @param unix_permissions[Fixnum?] which UNIX permissions to set, normally the default should be used
- # @yield
- # sink[#<<, #write]
+ # @param unix_permissions[Integer] which UNIX permissions to set, normally the default should be used
+ # @yieldparam sink[ZipKit::Streamer::Writable]
# an object that the file contents must be written to.
# Do not call `#close` on it - Streamer will do it for you. Write in chunks to achieve proper streaming
# output (using `IO.copy_stream` is a good approach).
- # @return [#<<, #write, #close] an object that the file contents must be written to, has to be closed manually
+ # @return [ZipKit::Streamer::Writable] without a block - the Writable sink which has to be closed manually
def write_file(filename, modification_time: Time.now.utc, unix_permissions: nil, &blk)
writable = ZipKit::Streamer::Heuristic.new(self, filename, modification_time: modification_time, unix_permissions: unix_permissions)
yield_or_return_writable(writable, &blk)
end
@@ -311,17 +310,16 @@
# adding the ZIP file. Note that you will need to call `write_deflated_file` again to start a
# new file - you can't keep writing to the one that failed.
#
# @param filename[String] the name of the file in the archive
# @param modification_time [Time] the modification time of the file in the archive
- # @param unix_permissions[Fixnum?] which UNIX permissions to set, normally the default should be used
- # @yield
- # sink[#<<, #write]
+ # @param unix_permissions[Integer] which UNIX permissions to set, normally the default should be used
+ # @yieldparam sink[ZipKit::Streamer::Writable]
# an object that the file contents must be written to.
# Do not call `#close` on it - Streamer will do it for you. Write in chunks to achieve proper streaming
# output (using `IO.copy_stream` is a good approach).
- # @return [#<<, #write, #close] an object that the file contents must be written to, has to be closed manually
+ # @return [ZipKit::Streamer::Writable] without a block - the Writable sink which has to be closed manually
def write_stored_file(filename, modification_time: Time.now.utc, unix_permissions: nil, &blk)
add_stored_entry(filename: filename,
modification_time: modification_time,
use_data_descriptor: true,
crc32: 0,
@@ -371,16 +369,15 @@
# adding the ZIP file. Note that you will need to call `write_deflated_file` again to start a
# new file - you can't keep writing to the one that failed.
#
# @param filename[String] the name of the file in the archive
# @param modification_time [Time] the modification time of the file in the archive
- # @param unix_permissions[Fixnum?] which UNIX permissions to set, normally the default should be used
- # @yield
- # sink[#<<, #write]
+ # @param unix_permissions[Integer] which UNIX permissions to set, normally the default should be used
+ # @yieldparam sink[ZipKit::Streamer::Writable]
# an object that the file contents must be written to.
# Do not call `#close` on it - Streamer will do it for you. Write in chunks to achieve proper streaming
# output (using `IO.copy_stream` is a good approach).
- # @return [#<<, #write, #close] an object that the file contents must be written to, has to be closed manually
+ # @return [ZipKit::Streamer::Writable] without a block - the Writable sink which has to be closed manually
def write_deflated_file(filename, modification_time: Time.now.utc, unix_permissions: nil, &blk)
add_deflated_entry(filename: filename,
modification_time: modification_time,
use_data_descriptor: true,
crc32: 0,