End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
URI.parse
parse(uri)
lib/uri/common.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/uri/common.rb, line 170
def self.parse(uri)
RFC3986_PARSER.parse(uri)
end
Synopsis
Example
URI::parse(uri_str)
Args
Description
Creates one of the URI’s subclasses instance from the string.
Raises
URI::InvalidURIError-
Raised if
URIgiven is not a correct one.
Usage
Example
require 'uri' uri = URI.parse("http://www.ruby-lang.org/") # => #<URI::HTTP http://www.ruby-lang.org/> uri.scheme # => "http" uri.host # => "www.ruby-lang.org"
It’s recommended to first ::escape the provided uri_str if there are any invalid URI characters.