Sha256: e29f586c71784cfa82cf6dc29eee266787c3d1a16c6009f55cee8e330523157e

Contents?: true

Size: 525 Bytes

Versions: 10

Compression:

Stored size: 525 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 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

10 entries across 10 versions & 1 rubygems

Version Path
iostreams-0.15.0 lib/io_streams/gzip/writer.rb
iostreams-0.14.0 lib/io_streams/gzip/writer.rb
iostreams-0.13.0 lib/io_streams/gzip/writer.rb
iostreams-0.12.1 lib/io_streams/gzip/writer.rb
iostreams-0.12.0 lib/io_streams/gzip/writer.rb
iostreams-0.11.0 lib/io_streams/gzip/writer.rb
iostreams-0.10.1 lib/io_streams/gzip/writer.rb
iostreams-0.10.0 lib/io_streams/gzip/writer.rb
iostreams-0.9.1 lib/io_streams/gzip/writer.rb
iostreams-0.9.0 lib/io_streams/gzip/writer.rb