Class: Gelfd2::GzipParser

Inherits:
Object
  • Object
show all
Defined in:
lib/gelfd2/gzip_parser.rb

Class Method Summary collapse

Class Method Details

.parse(data) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/gelfd2/gzip_parser.rb', line 5

def self.parse(data)
  begin
    t = Zlib::GzipReader.new(StringIO.new(data))
    decompressed = t.read
    t.close  # may trigger CRCError if there was corruption
    decompressed
  #raise NotYetImplementedError, "GZip decoding is not yet implemented"
  rescue Exception => e
    raise DecodeError, "Failed to decode data: #{e}"
  end
end