class ActionDispatch::Journey::Router::Utils
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/action_dispatch/journey/router/utils.rbs class ActionDispatch::Journey::Router::Utils def self.escape_segment: (String segment) -> String end
: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)
Experimental RBS support (using type sampling data from the type_fusion
project).
def self.escape_segment: (String segment) -> String
This signature was generated using 2 samples from 1 application.
def self.escape_segment(segment) ENCODER.escape_segment(segment.to_s) end
def self.normalize_path(path)
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)
uri = "/topics?title=Ruby%20on%20Rails"
Replaces any escaped sequences with their unescaped representations.
def self.unescape_uri(uri) ENCODER.unescape_uri(uri) end