Class: WhackANode::Redirect
- Inherits:
-
Object
- Object
- WhackANode::Redirect
- Defined in:
- lib/whack_a_node/redirect.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(path = "/", host = "localhost", port = "8810") ⇒ Redirect
constructor
A new instance of Redirect.
- #uri ⇒ Object
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 |
#uri ⇒ Object
14 15 16 |
# File 'lib/whack_a_node/redirect.rb', line 14 def uri URI("http://#{@host}:#{@port}#{@path}") end |