Method: Zlib::Inflate#inflate

Defined in:
lib/pr/zlib/inflate.rb

#inflate(src) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pr/zlib/inflate.rb', line 51

def inflate(src)
  if @z.ZSTREAM_IS_FINISHED()
    if src.nil?
      dst = @z.zstream_detach_buffer()
    else
      @z.zstream_append_buffer(src, src.lenth)
      dst = ''
    end
  else
    do_inflate(src)
    dst = @z.zstream_detach_buffer()
    if @z.ZSTREAM_IS_FINISHED()
      @z.zstream_passthrough_input()
    end
  end
  if block_given?
   yield dst
  else
    dst
  end
end