Class: Richard::Response
- Inherits:
-
Object
- Object
- Richard::Response
- Defined in:
- lib/richard_iii/request_and_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #each_header(&block) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(opts = {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(opts = {}) ⇒ Response
Returns a new instance of Response.
17 18 19 |
# File 'lib/richard_iii/request_and_response.rb', line 17 def initialize(opts={}) @status,@headers,@body = opts[:status],opts[:headers],opts[:body] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
15 16 17 |
# File 'lib/richard_iii/request_and_response.rb', line 15 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
15 16 17 |
# File 'lib/richard_iii/request_and_response.rb', line 15 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
15 16 17 |
# File 'lib/richard_iii/request_and_response.rb', line 15 def status @status end |
Instance Method Details
#each_header(&block) ⇒ Object
25 26 27 |
# File 'lib/richard_iii/request_and_response.rb', line 25 def each_header(&block) self.headers.each_pair{|k,v| block.call(k,v)} end |
#eql?(other) ⇒ Boolean
21 22 23 |
# File 'lib/richard_iii/request_and_response.rb', line 21 def eql?(other) self.status.eql?(other.status) && self.headers == other.headers && self.body.eql?(other.body) end |