Sha256: ecad3ba863f2232167540acaad1e92738282205971aea2a5d8be37f46b5803d2

Contents?: true

Size: 556 Bytes

Versions: 13

Compression:

Stored size: 556 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, **args, &block)
        unless IOStreams.reader_stream?(file_name_or_io)
          ::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

13 entries across 13 versions & 1 rubygems

Version Path
iostreams-0.20.3 lib/io_streams/gzip/reader.rb
iostreams-0.20.2 lib/io_streams/gzip/reader.rb
iostreams-0.20.1 lib/io_streams/gzip/reader.rb
iostreams-0.20.0 lib/io_streams/gzip/reader.rb
iostreams-0.19.0 lib/io_streams/gzip/reader.rb
iostreams-0.18.0 lib/io_streams/gzip/reader.rb
iostreams-0.17.3 lib/io_streams/gzip/reader.rb
iostreams-0.17.2 lib/io_streams/gzip/reader.rb
iostreams-0.17.1 lib/io_streams/gzip/reader.rb
iostreams-0.17.0 lib/io_streams/gzip/reader.rb
iostreams-0.16.2 lib/io_streams/gzip/reader.rb
iostreams-0.16.1 lib/io_streams/gzip/reader.rb
iostreams-0.16.0 lib/io_streams/gzip/reader.rb