123456789_123456789_123456789_123456789_123456789_

Class: WEBrick::HTTPResponse::ChunkedWrapper

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: lib/webrick/httpresponse.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(socket, resp) ⇒ ChunkedWrapper

[ GitHub ]

  
# File 'lib/webrick/httpresponse.rb', line 487

def initialize(socket, resp)
  @socket = socket
  @resp = resp
end

Instance Method Details

#<<(*buf)

[ GitHub ]

  
# File 'lib/webrick/httpresponse.rb', line 505

def <<(*buf)
  write(buf)
  self
end

#write(buf)

[ GitHub ]

  
# File 'lib/webrick/httpresponse.rb', line 492

def write(buf)
  return 0 if buf.empty?
  socket = @socket
  @resp.instance_eval {
    size = buf.bytesize
    data = "#{size.to_s(16)}#{CRLF}#{buf}#{CRLF}"
    socket.write(data)
    data.clear
    @sent_size += size
    size
  }
end