Class: Swaggable::RackResponseAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/swaggable/rack_response_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(rack_response = default_rack_response) ⇒ RackResponseAdapter

Returns a new instance of RackResponseAdapter.



3
4
5
# File 'lib/swaggable/rack_response_adapter.rb', line 3

def initialize rack_response = default_rack_response
  @rack_response = rack_response
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



23
24
25
26
27
28
29
# File 'lib/swaggable/rack_response_adapter.rb', line 23

def == other
  if other.respond_to? :rack_response, true
    rack_response == other.rack_response
  else
    false
  end
end

#codeObject



15
16
17
# File 'lib/swaggable/rack_response_adapter.rb', line 15

def code
  rack_response[0]
end

#code=(value) ⇒ Object



19
20
21
# File 'lib/swaggable/rack_response_adapter.rb', line 19

def code= value
  rack_response[0] = value
end

#content_typeObject



7
8
9
# File 'lib/swaggable/rack_response_adapter.rb', line 7

def content_type
  rack_headers['Content-Type']
end

#content_type=(value) ⇒ Object



11
12
13
# File 'lib/swaggable/rack_response_adapter.rb', line 11

def content_type= value
  rack_headers['Content-Type'] = value
end

#hashObject



33
34
35
# File 'lib/swaggable/rack_response_adapter.rb', line 33

def hash
  rack_response.hash
end