Class: RackStep::Response

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

Instance Method Summary collapse

Instance Method Details

#body=(value) ⇒ Object

The original body= method of Rack::Response expects an array. In RackStep the user may set it as a String and we will convert it to array if necessary.



11
12
13
14
15
16
17
# File 'lib/response.rb', line 11

def body=(value)
  if value.is_a?(String)
    value = [value]
  end

  super(value)
end

#content_typeObject

Helpers



20
21
22
# File 'lib/response.rb', line 20

def content_type
  headers['Content-Type']
end

#content_type=(value) ⇒ Object



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

def content_type=(value)
  headers['Content-Type'] = value
end

#redirect_to(address) ⇒ Object



26
27
28
29
# File 'lib/response.rb', line 26

def redirect_to(address)
  @status = 302
  headers['Location'] = address
end