Class: Yarn::Response
- Inherits:
-
Object
- Object
- Yarn::Response
- Defined in:
- lib/yarn/response.rb
Overview
Holds the response status, headers and body in an Array.
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
-
#body ⇒ Object
Body Array get.
-
#body=(body) ⇒ Object
Body Array set.
-
#headers ⇒ Object
Headers Hash get.
-
#headers=(headers) ⇒ Object
Headers Hash set.
-
#initialize ⇒ Response
constructor
A new instance of Response.
-
#status ⇒ Object
HTTP status code get.
-
#status=(status) ⇒ Object
HTTP status code set.
-
#to_s ⇒ Object
Format to string.
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
7 8 9 |
# File 'lib/yarn/response.rb', line 7 def initialize @content = [nil, {}, []] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
5 6 7 |
# File 'lib/yarn/response.rb', line 5 def content @content end |
Instance Method Details
#body ⇒ Object
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 |
#headers ⇒ Object
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 |
#status ⇒ Object
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_s ⇒ Object
Format to string
42 43 44 |
# File 'lib/yarn/response.rb', line 42 def to_s @content end |