Class: Rack::App::Middlewares::PathInfoCutter
- Inherits:
-
Object
- Object
- Rack::App::Middlewares::PathInfoCutter
- Defined in:
- lib/rack/app/middlewares/path_info_cutter.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, cut_string_from_path) ⇒ PathInfoCutter
constructor
A new instance of PathInfoCutter.
Constructor Details
#initialize(app, cut_string_from_path) ⇒ PathInfoCutter
Returns a new instance of PathInfoCutter.
3 4 5 6 |
# File 'lib/rack/app/middlewares/path_info_cutter.rb', line 3 def initialize(app, cut_string_from_path) @cut_string_from_path = cut_string_from_path @app = app end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/rack/app/middlewares/path_info_cutter.rb', line 8 def call(env) #env[::Rack::App::Constants::ENV::ORIGINAL_PATH_INFO]= env[::Rack::App::Constants::ENV::PATH_INFO] env[::Rack::App::Constants::ENV::PATH_INFO]= env[::Rack::App::Constants::ENV::PATH_INFO].dup env[::Rack::App::Constants::ENV::PATH_INFO].sub!(@cut_string_from_path, '') @app.call(env) end |