Class: Vidibus::RoutingError::Rack

Inherits:
Object
  • Object
show all
Defined in:
lib/vidibus/routing_error/rack.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Rack

Returns a new instance of Rack.



4
5
6
# File 'lib/vidibus/routing_error/rack.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/vidibus/routing_error/rack.rb', line 8

def call(env)
  response = @app.call(env)
  if response[0] == 404
    env['vidibus-routing_error.request_uri'] = env['REQUEST_URI']
    env['PATH_INFO'] = env['REQUEST_URI'] = '/routing_error'
    @app.call(env)
  else
    response
  end
end