Class: Blix::Rest::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/blix/rest/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

Returns a new instance of Response.



13
14
15
16
17
# File 'lib/blix/rest/response.rb', line 13

def initialize
  @status  = 200
  @headers  = Rack::Headers.new
  @content = nil
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



11
12
13
# File 'lib/blix/rest/response.rb', line 11

def content
  @content
end

#headersObject (readonly)

Returns the value of attribute headers.



10
11
12
# File 'lib/blix/rest/response.rb', line 10

def headers
  @headers
end

#statusObject

Returns the value of attribute status.



9
10
11
# File 'lib/blix/rest/response.rb', line 9

def status
  @status
end

Instance Method Details

#set(status, content = nil, headers = nil) ⇒ Object



19
20
21
22
23
# File 'lib/blix/rest/response.rb', line 19

def set(status,content=nil,headers=nil)
  @status = status if status
  @content = [String.new(content)] if content
  @headers.merge!(headers) if headers
end