Class: Wouter::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/wouter.rb

Overview

Outgoing HTTP Response Wrapper

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

Returns a new instance of Response.



20
21
22
23
24
# File 'lib/wouter.rb', line 20

def initialize
  @headers = {'Content-Type' => 'text/html'}
  @body = ""
  @status = 200
end

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



18
19
20
# File 'lib/wouter.rb', line 18

def headers
  @headers
end

Instance Method Details

#body(b) ⇒ Object



26
27
28
29
# File 'lib/wouter.rb', line 26

def body(b)
  @body = b
  self
end

#build_responseObject



36
37
38
# File 'lib/wouter.rb', line 36

def build_response
  [@status, @headers, [@body]]
end

#status(s) ⇒ Object



31
32
33
34
# File 'lib/wouter.rb', line 31

def status(s)
  @status = s
  self
end