Class: Warden::Redirect

Inherits:
Array
  • Object
show all
Defined in:
lib/warden/redirect.rb,
lib/warden/redirect/version.rb

Constant Summary collapse

VERSION =
'1.0.0'

Instance Method Summary collapse

Constructor Details

#initialize(location, status = 302, headers = {}) ⇒ Redirect

Returns a new instance of Redirect.



3
4
5
6
7
# File 'lib/warden/redirect.rb', line 3

def initialize(location, status = 302, headers = {})
  redirect_headers = headers.merge({ "Content-Type" => "text/html", "Location" => location })
  body = "<html><body>You are being redirected to <a href='#{location}'>#{location}</a></body></html>"
  super [status,redirect_headers,[body]]
end

Instance Method Details

#bodyObject



11
# File 'lib/warden/redirect.rb', line 11

def body;    self[2]; end

#headersObject



10
# File 'lib/warden/redirect.rb', line 10

def headers; self[1]; end

#statusObject



9
# File 'lib/warden/redirect.rb', line 9

def status;  self[0]; end