module Rack::Utils

def clean_path_info(path_info)

Experimental RBS support (using type sampling data from the type_fusion project).

def clean_path_info: (String path_info) -> String

This signature was generated using 1 sample from 1 application.

def clean_path_info(path_info)
  parts = path_info.split PATH_SEPS
  clean = []
  parts.each do |part|
    next if part.empty? || part == '.'
    part == '..' ? clean.pop : clean << part
  end
  clean_path = clean.join(::File::SEPARATOR)
  clean_path.prepend("/") if parts.empty? || parts.first.empty?
  clean_path
end