[ruby/uri] [DOC] Update old use of URI::Parser

d2a79c6343
This commit is contained in:
Nobuyoshi Nakada 2025-07-14 13:54:07 +09:00 committed by git
parent d147091418
commit 8f54b5bb93
2 changed files with 12 additions and 13 deletions

View file

@ -284,7 +284,7 @@ module URI
# Returns the parser to be used.
#
# Unless a URI::Parser is defined, DEFAULT_PARSER is used.
# Unless the +parser+ is defined, DEFAULT_PARSER is used.
#
def parser
if !defined?(@parser) || !@parser
@ -315,7 +315,7 @@ module URI
end
#
# Checks the scheme +v+ component against the URI::Parser Regexp for :SCHEME.
# Checks the scheme +v+ component against the +parser+ Regexp for :SCHEME.
#
def check_scheme(v)
if v && parser.regexp[:SCHEME] !~ v
@ -385,7 +385,7 @@ module URI
#
# Checks the user +v+ component for RFC2396 compliance
# and against the URI::Parser Regexp for :USERINFO.
# and against the +parser+ Regexp for :USERINFO.
#
# Can not have a registry or opaque component defined,
# with a user component defined.
@ -409,7 +409,7 @@ module URI
#
# Checks the password +v+ component for RFC2396 compliance
# and against the URI::Parser Regexp for :USERINFO.
# and against the +parser+ Regexp for :USERINFO.
#
# Can not have a registry or opaque component defined,
# with a user component defined.
@ -586,7 +586,7 @@ module URI
#
# Checks the host +v+ component for RFC2396 compliance
# and against the URI::Parser Regexp for :HOST.
# and against the +parser+ Regexp for :HOST.
#
# Can not have a registry or opaque component defined,
# with a host component defined.
@ -675,7 +675,7 @@ module URI
#
# Checks the port +v+ component for RFC2396 compliance
# and against the URI::Parser Regexp for :PORT.
# and against the +parser+ Regexp for :PORT.
#
# Can not have a registry or opaque component defined,
# with a port component defined.
@ -748,7 +748,7 @@ module URI
#
# Checks the path +v+ component for RFC2396 compliance
# and against the URI::Parser Regexp
# and against the +parser+ Regexp
# for :ABS_PATH and :REL_PATH.
#
# Can not have a opaque component defined,
@ -853,7 +853,7 @@ module URI
#
# Checks the opaque +v+ component for RFC2396 compliance and
# against the URI::Parser Regexp for :OPAQUE.
# against the +parser+ Regexp for :OPAQUE.
#
# Can not have a host, port, user, or path component defined,
# with an opaque component defined.
@ -905,7 +905,7 @@ module URI
end
#
# Checks the fragment +v+ component against the URI::Parser Regexp for :FRAGMENT.
# Checks the fragment +v+ component against the +parser+ Regexp for :FRAGMENT.
#
#
# == Args

View file

@ -67,7 +67,7 @@ module URI
#
# == Synopsis
#
# URI::Parser.new([opts])
# URI::RFC2396_Parser.new([opts])
#
# == Args
#
@ -86,7 +86,7 @@ module URI
#
# == Examples
#
# p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
# p = URI::RFC2396_Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
# u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP http://example.jp/%uABCD>
# URI.parse(u.to_s) #=> raises URI::InvalidURIError
#
@ -202,8 +202,7 @@ module URI
#
# == Usage
#
# p = URI::Parser.new
# p.parse("ldap://ldap.example.com/dc=example?user=john")
# URI::RFC2396_PARSER.parse("ldap://ldap.example.com/dc=example?user=john")
# #=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>
#
def parse(uri)