Class: Yarn::Response

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

Overview

Holds the response status, headers and body in an Array.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

Returns a new instance of Response.



7
8
9
# File 'lib/yarn/response.rb', line 7

def initialize
  @content = [nil, {}, []]      
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



5
6
7
# File 'lib/yarn/response.rb', line 5

def content
  @content
end

Instance Method Details

#bodyObject

Body Array get



37
38
39
# File 'lib/yarn/response.rb', line 37

def body
  @content[2]
end

#body=(body) ⇒ Object

Body Array set



32
33
34
# File 'lib/yarn/response.rb', line 32

def body=(body)
  @content[2] = body
end

#headersObject

Headers Hash get



27
28
29
# File 'lib/yarn/response.rb', line 27

def headers
  @content[1]
end

#headers=(headers) ⇒ Object

Headers Hash set



22
23
24
# File 'lib/yarn/response.rb', line 22

def headers=(headers)
  @content[1] = headers
end

#statusObject

HTTP status code get



17
18
19
# File 'lib/yarn/response.rb', line 17

def status
  @content[0]
end

#status=(status) ⇒ Object

HTTP status code set



12
13
14
# File 'lib/yarn/response.rb', line 12

def status=(status)
  @content[0] = status
end

#to_sObject

Format to string



42
43
44
# File 'lib/yarn/response.rb', line 42

def to_s
  @content
end