Exception: Orange::Reroute
- Defined in:
- lib/orange-core/middleware/rerouter.rb
Instance Method Summary collapse
-
#initialize(packet) ⇒ Reroute
constructor
A new instance of Reroute.
- #packet ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(packet) ⇒ Reroute
Returns a new instance of Reroute.
31 32 33 34 35 |
# File 'lib/orange-core/middleware/rerouter.rb', line 31 def initialize(packet) @packet = packet @packet[:headers] = {"Content-Type" => 'text/html', "Location" => self.url} @packet[:status] = 302 end |
Instance Method Details
#packet ⇒ Object
49 50 51 |
# File 'lib/orange-core/middleware/rerouter.rb', line 49 def packet @packet end |
#url ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/orange-core/middleware/rerouter.rb', line 37 def url case packet['reroute.type'] when :real packet['reroute.to'] # Parsing for orange urls or something when :orange "http://"+packet.env['HTTP_HOST']+packet.route_to(packet['reroute.to'], *packet['reroute.args', []]) else packet['reroute.to'] end end |