From eaf2497c67b4cc0350ec7cb3a705cf80c5a1ee56 Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Tue, 18 Jun 2024 18:57:05 +0100 Subject: [PATCH] use optional record keys for several API options --- stdlib/cgi/0/core.rbs | 8 +++++- stdlib/csv/0/csv.rbs | 40 ++++++++++++++++++++++++++--- stdlib/openssl/0/openssl.rbs | 50 ++++++++++++++++++++++++++++++++---- stdlib/uri/0/file.rbs | 6 ++++- stdlib/uri/0/generic.rbs | 20 ++++++++++++--- stdlib/uri/0/http.rbs | 11 +++++++- stdlib/uri/0/ldap.rbs | 12 ++++++++- stdlib/uri/0/mailto.rbs | 11 +++++--- 8 files changed, 138 insertions(+), 20 deletions(-) diff --git a/stdlib/cgi/0/core.rbs b/stdlib/cgi/0/core.rbs index aea53b09a..4fbeec26c 100644 --- a/stdlib/cgi/0/core.rbs +++ b/stdlib/cgi/0/core.rbs @@ -273,6 +273,12 @@ class CGI extend CGI::Util + type options_hash = { + ?accept_charset: String, + ?tag_maker: String, + ?max_multipart_length: Integer | ^() -> Integer + } + # # An Enumerable of Strings. Each String represents a protocol to be advertised @@ -8195,7 +8235,7 @@ module OpenSSL # # ctx.npn_protocols = ["http/1.1", "spdy/2"] # - def npn_protocols=: (untyped) -> untyped + def npn_protocols=: (Array[String]? protos) -> Array[String] # # A callback invoked on the client side when the client needs to select a @@ -8213,7 +8253,7 @@ module OpenSSL # protocols.first # end # - def npn_select_cb: () -> untyped + def npn_select_cb: () -> (^(Array[String]) -> String? | nil) # # A callback invoked on the client side when the client needs to select a @@ -8231,7 +8271,7 @@ module OpenSSL # protocols.first # end # - def npn_select_cb=: (untyped) -> untyped + def npn_select_cb=: (^(Array[String]) -> String? alpn_select_callback) -> void # # A Default port of nil for URI::File. # @@ -47,7 +51,7 @@ module URI # uri3.to_s # => "file:///path/my%20file.txt" # def self.build: (Array[String] args) -> URI::File - | ({ host: String?, path: String? }) -> URI::File + | (build_opts args) -> URI::File # # A Default port of nil for URI::Generic. # @@ -153,8 +165,8 @@ module URI # URI::Generic::build. But, if exception URI::InvalidComponentError is raised, # then it does URI::Escape.escape all URI components and tries again. # - def self.build2: (Array[nil | String | Integer]) -> URI::Generic - | ({ scheme: String?, userinfo: String?, host: String?, port: Integer?, registry: String?, path: String?, opaque: String?, query: String?, fragment: String? }) -> instance + def self.build2: (Array[nil | String | Integer] args) -> URI::Generic + | (build_opts args) -> instance # # A Default port of 80 for URI::HTTP. # @@ -46,7 +55,7 @@ module URI # URIs as per RFC 1738. # def self.build: (Array[String | Integer] args) -> instance - | ({ userinfo: String?, host: String?, port: Integer?, path: String?, query: String?, fragment: String? }) -> instance + | (build_opts args) -> instance # # A Default port of 389 for URI::LDAP. # @@ -50,7 +60,7 @@ module URI # "/dc=example;dc=com", "query", nil, nil, nil]) # def self.build: (Array[nil | String | Integer] args) -> URI::LDAP - | ({ host: String?, port: Integer?, dn: String?, attributes: String?, scope: String?, filter: String?, extensions: String? }) -> URI::LDAP + | (build_opts args) -> URI::LDAP # # E-mail headers set by the URL, as an Array of Arrays.