Class: WhackANode::Redirect

Inherits:
Object
  • Object
show all
Defined in:
lib/whack_a_node/redirect.rb

Instance Method Summary collapse

Constructor Details

#initialize(path = "/", host = "localhost", port = "8810") ⇒ Redirect

Returns a new instance of Redirect.



4
5
6
7
8
# File 'lib/whack_a_node/redirect.rb', line 4

def initialize(path="/",host="localhost", port="8810")
  @path = path
  @host = host
  @port = port
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
# File 'lib/whack_a_node/redirect.rb', line 10

def call(env)
  [ 302, {'Location'=> uri.to_s }, [] ]
end

#uriObject



14
15
16
# File 'lib/whack_a_node/redirect.rb', line 14

def uri
  URI("http://#{@host}:#{@port}#{@path}")
end