Method: Merb::Rack::PathPrefix#strip_path_prefix

Defined in:
lib/merb-core/rack/middleware/path_prefix.rb

#strip_path_prefix(env) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/merb-core/rack/middleware/path_prefix.rb', line 20

def strip_path_prefix(env)
  ['PATH_INFO', 'REQUEST_URI'].each do |path_key|
    if env[path_key] =~ @path_prefix
      env[path_key].sub!(@path_prefix, '')
      env[path_key] = '/' if env[path_key].empty?
    end
  end
end