Class: Mxrb::Http::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/mxrb/http/server.rb

Overview

Mutable response keeps the existing MXRB dispatchers independent of Rack.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

Returns a new instance of Response.



26
27
28
29
30
# File 'lib/mxrb/http/server.rb', line 26

def initialize
  @status = 200
  @body = ''
  @headers = {}
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



23
24
25
# File 'lib/mxrb/http/server.rb', line 23

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



24
25
26
# File 'lib/mxrb/http/server.rb', line 24

def headers
  @headers
end

#statusObject

Returns the value of attribute status.



23
24
25
# File 'lib/mxrb/http/server.rb', line 23

def status
  @status
end

Instance Method Details

#[](name) ⇒ Object



32
# File 'lib/mxrb/http/server.rb', line 32

def [](name) = headers[name]

#[]=(name, value) ⇒ Object



34
35
36
# File 'lib/mxrb/http/server.rb', line 34

def []=(name, value)
  headers[name] = value
end