Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
URI.split
(::_ToStr uri) -> [ ::String?, ::String?, ::String?, ::String?, nil, ::String?, ::String?, ::String?, ::String? ]
split(uri)
lib/uri/common.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/uri/common.rb, line 193
def self.split(uri)
DEFAULT_PARSER.split(uri)
end
Returns a 9-element array representing the parts of the URI formed from the string uri; each array element is a string or nil:
Example
names = %w[scheme userinfo host port registry path opaque query fragment] values = URI.split('https://[email protected]:123/forum/questions/?tag=networking&order=newest#top') names.zip(values) # => [["scheme", "https"], ["userinfo", "john.doe"], ["host", "www.example.com"], ["port", "123"], ["registry", nil], ["path", "/forum/questions/"], ["opaque", nil], ["query", "tag=networking&order=newest"], ["fragment", "top"]]