Class: Richard::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/richard_iii/request_and_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (readonly)

Returns the value of attribute body.



15
16
17
# File 'lib/richard_iii/request_and_response.rb', line 15

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



15
16
17
# File 'lib/richard_iii/request_and_response.rb', line 15

def headers
  @headers
end

#statusObject (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

Returns:

  • (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