class Response

Public Class Methods

new(code:, body: "") click to toggle source
# File lib/http.rb, line 30
def initialize(code:, body: "")
  @code = code
  @response = 
    "HTTP/1.1 #{code}\r\n" +
    "Content-Length: #{body.size}\r\n" +
    "\r\n" +
    "#{body}\r\n"
end

Public Instance Methods

code() click to toggle source
# File lib/http.rb, line 43
def code 
  @code
end
send(client) click to toggle source
# File lib/http.rb, line 39
def send(client)
  client.write(@response)
end