Sha256: 3cc52ea9240b66661fcac12155506685a3817fcce92fee7006b496c0a1e9c6e8

Contents?: true

Size: 400 Bytes

Versions: 1

Compression:

Stored size: 400 Bytes

Contents

require 'alf'
require 'zlib'
class GzReader < Alf::Reader

  def each
    keys = nil
    with_input_io do |io|
      reader = Zlib::GzipReader.new(io)
      reader.each_line do |line|
        decoded = eval(line)
        if keys.nil?
          keys = decoded
        else
          yield Hash[keys.zip(decoded)]
        end
      end
    end
  end

  Alf::Reader.register(:gz, [".gz"], self)  
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-0.10.1 examples/hitradio/gz_reader.rb