Class: RackPathInfoFix
- Inherits:
-
Object
- Object
- RackPathInfoFix
- Defined in:
- lib/rack_pathinfo_fix.rb
Overview
Rack PathInfo Fix
This class is a Rack Middleware that fixes up PATH_INFO to be correct for Rack based apps.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RackPathInfoFix
constructor
A new instance of RackPathInfoFix.
Constructor Details
#initialize(app) ⇒ RackPathInfoFix
6 7 8 |
# File 'lib/rack_pathinfo_fix.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rack_pathinfo_fix.rb', line 10 def call(env) pi = env['PATH_INFO'] sn = env['SCRIPT_NAME'] if pi != sn env['PATH_INFO'] = File.join(sn, pi) end @app.call env end |