class Seahorse::Client::BlockIO

def initialize(headers = nil, &block)

def initialize(headers = nil, &block)
  @headers = headers
  @block = block
  @size = 0
end

def read(bytes = nil, output_buffer = nil)

Returns:
  • (String, nil) -

Parameters:
  • output_buffer (String) -- (nil)
  • bytes (Integer) -- (nil)
def read(bytes = nil, output_buffer = nil)
  data = bytes ? nil : ''
  output_buffer ? output_buffer.replace(data || '') : data
end

def size

Returns:
  • (Integer) -
def size
  @size
end

def write(chunk)

Returns:
  • (Integer) -

Parameters:
  • chunk (String) --
def write(chunk)
  @block.call(chunk, @headers)
ensure
  chunk.bytesize.tap { |chunk_size| @size += chunk_size }
end