Class: Response

Inherits:
Rack::Response
  • Object
show all
Defined in:
lib/cubic/response.rb

Overview

Handles how to create Rack::Response

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Response

Returns a new instance of Response.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/cubic/response.rb', line 4

def initialize(content)
  if content[:body].respond_to?(:call)
    return super('content', &content[:body])
  end

  body = content[:body] || ''
  status = content[:status] || 200
  headers = content[:headers] || {}

  super(body, status, headers)
end