stdlib/uri/0/common.rbs in rbs-1.8.1 vs stdlib/uri/0/common.rbs in rbs-2.0.0.pre1
- old
+ new
@@ -152,11 +152,11 @@
# URI.encode_www_form([["q", "ruby"], ["q", "perl"], ["lang", "en"]])
# #=> "q=ruby&q=perl&lang=en"
#
# See URI.encode_www_form_component, URI.decode_www_form.
#
- def self.encode_www_form: (Enumerable[[ _ToS, _ToS ]] enum, ?encoding enc) -> String
+ def self.encode_www_form: (Enumerable[[ _ToS, _ToS ]] enum, ?encoding? enc) -> String
# Encodes given `str` to URL-encoded form data.
#
# This method doesn't convert *, -, ., 0-9, A-Z, _, a-z, but does convert SP
# (ASCII space) to + and converts others to %XX.
@@ -166,11 +166,11 @@
# This is an implementation of
# http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data.
#
# See URI.decode_www_form_component, URI.encode_www_form.
#
- def self.encode_www_form_component: (String str, ?encoding enc) -> String
+ def self.encode_www_form_component: (_ToS str, ?encoding? enc) -> String
# ## Synopsis
#
# URI::extract(str[, schemes][,&blk])
#
@@ -266,11 +266,11 @@
# # => "www.ruby-lang.org"
#
# It's recommended to first ::escape the provided `uri_str` if there are any
# invalid URI characters.
#
- def self.parse: (String uri) -> URI::Generic
+ def self.parse: (_ToStr uri) -> (File | FTP | HTTP | HTTPS | LDAP | LDAPS | MailTo | WS | WSS | Generic)
# ## Synopsis
#
# URI::regexp([match_schemes])
#
@@ -300,16 +300,21 @@
# # You should not rely on the number of parentheses
# html_string.scan(URI.regexp) do |*matches|
# p $&
# end
#
- def self.regexp: (?Array[String] schemes) -> Regexp
+ def self.regexp: (?Array[String]? schemes) -> Regexp
# Returns a Hash of the defined schemes.
#
def self.scheme_list: () -> Hash[String, Class]
+ # Construct a URI instance, using the scheme to detect the appropriate class
+ # from +URI.scheme_list+.
+ #
+ def self.for: (String scheme, *untyped arguments, ?default: Class) -> (File | FTP | HTTP | HTTPS | LDAP | LDAPS | MailTo | WS | WSS | Generic)
+
# ## Synopsis
#
# URI::split(uri)
#
# ## Args
@@ -338,10 +343,10 @@
# require 'uri'
#
# URI.split("http://www.ruby-lang.org/")
# # => ["http", nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]
#
- def self.split: (String uri) -> [ String?, String?, String?, String?, String?, String?, String?, String?, String? ]
+ def self.split: (_ToStr uri) -> [ String?, String?, String?, String?, nil, String?, String?, String?, String? ]
end
URI::ABS_PATH: Regexp
URI::ABS_URI: Regexp