mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/uri] Simplify construction of URI instances using parser interface.
c145017dd7
This commit is contained in:
parent
e460c2d033
commit
844ff7ea45
3 changed files with 16 additions and 25 deletions
|
@ -208,21 +208,9 @@ module URI
|
|||
# #=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>
|
||||
#
|
||||
def parse(uri)
|
||||
scheme, userinfo, host, port,
|
||||
registry, path, opaque, query, fragment = self.split(uri)
|
||||
|
||||
if scheme && URI.scheme_list.include?(scheme.upcase)
|
||||
URI.scheme_list[scheme.upcase].new(scheme, userinfo, host, port,
|
||||
registry, path, opaque, query,
|
||||
fragment, self)
|
||||
else
|
||||
Generic.new(scheme, userinfo, host, port,
|
||||
registry, path, opaque, query,
|
||||
fragment, self)
|
||||
end
|
||||
URI.for(*self.split(uri), self)
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# == Args
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue