Sha256: 9398520b462c616b86d81d551297d4bbe0503ee7f097a5eaee7e04882a9e3384

Contents?: true

Size: 555 Bytes

Versions: 10

Compression:

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

10 entries across 10 versions & 1 rubygems

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