Sha256: 121babd3b97c834dc5a3ee96df618a167258052d771ba676ff3574bb11d1df7c

Contents?: true

Size: 547 Bytes

Versions: 4

Compression:

Stored size: 547 Bytes

Contents

module IOStreams
  module Gzip
    class Reader
      # Read from a gzip file or stream, decompressing the contents as it is read
      def self.open(file_name_or_io, _=nil, &block)
        unless file_name_or_io.respond_to?(:read)
          ::Zlib::GzipReader.open(file_name_or_io, &block)
        else
          begin
            io = ::Zlib::GzipReader.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/reader.rb
iostreams-0.8.1 lib/io_streams/gzip/reader.rb
iostreams-0.8.0 lib/io_streams/gzip/reader.rb
iostreams-0.7.0 lib/io_streams/gzip/reader.rb