Class: Xenon::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponse

Returns a new instance of Response.



7
8
9
10
11
# File 'lib/xenon/response.rb', line 7

def initialize
  @headers = Headers.new
  @complete = false
  freeze
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



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

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#complete?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/xenon/response.rb', line 13

def complete?
  @complete
end

#copy(changes = {}) ⇒ Object



17
18
19
20
21
# File 'lib/xenon/response.rb', line 17

def copy(changes = {})
  r = dup
  changes.each { |k, v| r.instance_variable_set("@#{k}", v) }
  r.freeze
end

#freezeObject



23
24
25
26
27
# File 'lib/xenon/response.rb', line 23

def freeze
  @headers.freeze
  @body.freeze
  super
end