Sha256: 3eb04d08a08ffb7590d75be4f894e277ba1f0f74f0d85e29348ed9234a2a7b06

Contents?: true

Size: 526 Bytes

Versions: 7

Compression:

Stored size: 526 Bytes

Contents

module IOStreams
  module Gzip
    class Writer
      # Write to a file / stream, compressing with GZip
      def self.open(file_name_or_io, **args, &block)
        unless IOStreams.writer_stream?(file_name_or_io)
          Zlib::GzipWriter.open(file_name_or_io, &block)
        else
          begin
            io = Zlib::GzipWriter.new(file_name_or_io)
            block.call(io)
          ensure
            io.close if io && (io.respond_to?(:closed?) && !io.closed?)
          end
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
iostreams-0.17.3 lib/io_streams/gzip/writer.rb
iostreams-0.17.2 lib/io_streams/gzip/writer.rb
iostreams-0.17.1 lib/io_streams/gzip/writer.rb
iostreams-0.17.0 lib/io_streams/gzip/writer.rb
iostreams-0.16.2 lib/io_streams/gzip/writer.rb
iostreams-0.16.1 lib/io_streams/gzip/writer.rb
iostreams-0.16.0 lib/io_streams/gzip/writer.rb