Method: Down::ChunkedIO#initialize

Defined in:
lib/down/chunked_io.rb

#initialize(chunks:, size: nil, on_close: nil, data: {}, rewindable: true, encoding: nil) ⇒ ChunkedIO

Returns a new instance of ChunkedIO.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/down/chunked_io.rb', line 10

def initialize(chunks:, size: nil, on_close: nil, data: {}, rewindable: true, encoding: nil)
  @chunks     = chunks
  @size       = size
  @on_close   = on_close
  @data       = data
  @encoding   = find_encoding(encoding || Encoding::BINARY)
  @rewindable = rewindable
  @buffer     = nil
  @bytes_read = 0

  retrieve_chunk
end