Class: Warden::Redirect
- Inherits:
-
Array
- Object
- Array
- Warden::Redirect
- Defined in:
- lib/warden/redirect.rb,
lib/warden/redirect/version.rb
Constant Summary collapse
- VERSION =
'1.0.0'
Instance Method Summary collapse
- #body ⇒ Object
- #headers ⇒ Object
-
#initialize(location, status = 302, headers = {}) ⇒ Redirect
constructor
A new instance of Redirect.
- #status ⇒ Object
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
#body ⇒ Object
11 |
# File 'lib/warden/redirect.rb', line 11 def body; self[2]; end |
#headers ⇒ Object
10 |
# File 'lib/warden/redirect.rb', line 10 def headers; self[1]; end |
#status ⇒ Object
9 |
# File 'lib/warden/redirect.rb', line 9 def status; self[0]; end |