class ActionDispatch::Journey::Router::Utils

:nodoc:
:nodoc:
:nodoc:

def self.escape_fragment(fragment)

def self.escape_fragment(fragment)
  ENCODER.escape_fragment(fragment.to_s)
end

def self.escape_path(path)

def self.escape_path(path)
  ENCODER.escape_path(path.to_s)
end

def self.escape_segment(segment)

def self.escape_segment(segment)
  ENCODER.escape_segment(segment.to_s)
end

def self.normalize_path(path)

normalize_path("/%ab") # => "/%AB"
normalize_path("") # => "/"
normalize_path("foo") # => "/foo"
normalize_path("/foo/") # => "/foo"
normalize_path("/foo") # => "/foo"

Also converts downcase URL encoded string to uppercase.
Strips off trailing slash and ensures there is a leading slash.

Normalizes URI path.
:nodoc:
:nodoc:
:nodoc:
def self.normalize_path(path)
  path ||= ""
  encoding = path.encoding
  path = +"/#{path}"
  path.squeeze!("/")
  unless path == "/"
    path.delete_suffix!("/")
    path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
  end
  path.force_encoding(encoding)
end

def self.unescape_uri(uri)

unescape_uri(uri) #=> "/topics?title=Ruby on Rails"
uri = "/topics?title=Ruby%20on%20Rails"

Replaces any escaped sequences with their unescaped representations.
def self.unescape_uri(uri)
  ENCODER.unescape_uri(uri)
end