lib/io_streams/writer.rb in iostreams-1.10.1 vs lib/io_streams/writer.rb in iostreams-1.10.2

- old
+ new

@@ -2,11 +2,12 @@ class Writer # When a Writer does not support streams, we copy the stream to a local temp file # and then pass that filename in for this reader. def self.stream(output_stream, original_file_name: nil, **args, &block) Utils.temp_file_name("iostreams_writer") do |file_name| - file(file_name, original_file_name: original_file_name, **args, &block) + count = file(file_name, original_file_name: original_file_name, **args, &block) ::File.open(file_name, "rb") { |source| ::IO.copy_stream(source, output_stream) } + count end end # When a Writer supports streams, also allow it to simply support a file def self.file(file_name, original_file_name: file_name, **args, &block)