Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
URI.parse
parse(uri)
lib/uri/common.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/uri/common.rb, line 184
def self.parse(uri)
RFC3986_PARSER.parse(uri)
end
Returns a new URI object constructed from the given string uri:
Example
URI.parse('https://[email protected]:123/forum/questions/?tag=networking&order=newest#top') # => #<URI::HTTPS https://[email protected]:123/forum/questions/?tag=networking&order=newest#top> URI.parse('http://[email protected]:123/forum/questions/?tag=networking&order=newest#top') # => #<URI::HTTP http://[email protected]:123/forum/questions/?tag=networking&order=newest#top>
It’s recommended to first ::escape string uri if it may contain invalid URI characters.