Sha256: 03c5b3bdf3d3a85ad53f7b7cca0db9ae214391ba0e6375a4be1eca55a1c3f7f1

Contents?: true

Size: 518 Bytes

Versions: 4

Compression:

Stored size: 518 Bytes

Contents

module IOStreams
  module Gzip
    class Writer
      # Write to a file / stream, compressing with GZip
      def self.open(file_name_or_io, _=nil, &block)
        unless file_name_or_io.respond_to?(:write)
          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

4 entries across 4 versions & 1 rubygems

Version Path
iostreams-0.8.2 lib/io_streams/gzip/writer.rb
iostreams-0.8.1 lib/io_streams/gzip/writer.rb
iostreams-0.8.0 lib/io_streams/gzip/writer.rb
iostreams-0.7.0 lib/io_streams/gzip/writer.rb