Class: Navigable::Server::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/navigable/server/response.rb

Constant Summary collapse

CONTENT_TYPE =
'Content-Type'
CONTENT_LENGTH =
'Content-Length'
MIME_TYPE_JSON =
'application/json'
MIME_TYPE_HTML =
'text/html'
MIME_TYPE_TEXT =
'text/plain'
EMPTY_CONTENT =
''

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Response

Returns a new instance of Response.



15
16
17
18
# File 'lib/navigable/server/response.rb', line 15

def initialize(params)
  @params = params
  @status = params[:status] || 200
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



13
14
15
# File 'lib/navigable/server/response.rb', line 13

def params
  @params
end

#statusObject (readonly)

Returns the value of attribute status.



13
14
15
# File 'lib/navigable/server/response.rb', line 13

def status
  @status
end

Instance Method Details

#to_rack_responseObject



20
21
22
# File 'lib/navigable/server/response.rb', line 20

def to_rack_response
  [status, headers, [content]]
end