Class: RackDispatch::RedirectHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rack_dispatch/redirect_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, status: 302) ⇒ RedirectHandler

Returns a new instance of RedirectHandler.



3
4
5
6
# File 'lib/rack_dispatch/redirect_handler.rb', line 3

def initialize(path, status: 302)
  @path = path
  @status = status
end

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/rack_dispatch/redirect_handler.rb', line 8

def call
  [
  @status,
  {
    'Content-Type' => 'text/html',
    'Location' => @path,
  },
  ["Redirect to <a href=\"#@path\">#@path</a>"],
  ]
end