End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
URI::Generic#normalize
normalize
lib/uri/generic.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.1.3/lib/uri/generic.rb, line 1309
def normalize
uri = dup
uri.normalize!
uri
end
Returns normalized URI.
Example
require 'uri' URI("HTTP://my.EXAMPLE.com").normalize #=> #<URI::HTTP http://my.example.com/>
Normalization here means:
-
scheme and host are converted to lowercase,
-
an empty path component is set to “/”.