rbs 2.0.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +34 -0
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +82 -0
- data/README.md +6 -1
- data/Rakefile +56 -21
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +1214 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1060 -142
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2319 -318
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/docs/syntax.md +54 -11
- data/ext/rbs_extension/extconf.rb +1 -0
- data/ext/rbs_extension/lexer.h +5 -0
- data/ext/rbs_extension/lexstate.c +6 -0
- data/ext/rbs_extension/parser.c +85 -10
- data/ext/rbs_extension/ruby_objs.c +4 -2
- data/ext/rbs_extension/ruby_objs.h +2 -2
- data/goodcheck.yml +0 -11
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/ast/members.rb +21 -13
- data/lib/rbs/buffer.rb +17 -11
- data/lib/rbs/cli.rb +48 -1
- data/lib/rbs/definition_builder/method_builder.rb +28 -16
- data/lib/rbs/definition_builder.rb +6 -2
- data/lib/rbs/environment.rb +8 -4
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/type_alias_regularity.rb +6 -4
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +1 -1
- data/lib/rbs/validator.rb +6 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +54 -4
- data/lib/rbs.rb +0 -2
- data/schema/typeParam.json +3 -3
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/buffer.rbs +6 -2
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/members.rbs +24 -18
- data/sig/method_builder.rbs +5 -4
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/sig/validator.rbs +3 -1
- data/sig/writer.rbs +79 -2
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +649 -21
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1147 -145
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/manifest.yaml +1 -0
- data/stdlib/net-http/0/net-http.rbs +1513 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +423 -109
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +558 -329
- data/stdlib/uri/0/http.rbs +60 -114
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +18 -6
- data/lib/rbs/location.rb +0 -221
- data/sig/char_scanner.rbs +0 -9
data/stdlib/uri/0/generic.rbs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=lib/uri.rb -->
|
|
1
2
|
# URI is a module providing classes to handle Uniform Resource Identifiers
|
|
2
3
|
# ([RFC2396](http://tools.ietf.org/html/rfc2396)).
|
|
3
4
|
#
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
# class RSYNC < Generic
|
|
31
32
|
# DEFAULT_PORT = 873
|
|
32
33
|
# end
|
|
33
|
-
#
|
|
34
|
+
# register_scheme 'RSYNC', RSYNC
|
|
34
35
|
# end
|
|
35
36
|
# #=> URI::RSYNC
|
|
36
37
|
#
|
|
@@ -75,7 +76,6 @@
|
|
|
75
76
|
# * URI::REGEXP::PATTERN - (in uri/common.rb)
|
|
76
77
|
#
|
|
77
78
|
# * URI::Util - (in uri/common.rb)
|
|
78
|
-
# * URI::Escape - (in uri/common.rb)
|
|
79
79
|
# * URI::Error - (in uri/common.rb)
|
|
80
80
|
# * URI::InvalidURIError - (in uri/common.rb)
|
|
81
81
|
# * URI::InvalidComponentError - (in uri/common.rb)
|
|
@@ -93,39 +93,44 @@
|
|
|
93
93
|
# License
|
|
94
94
|
# : Copyright (c) 2001 akira yamada <akira@ruby-lang.org> You can redistribute
|
|
95
95
|
# it and/or modify it under the same term as Ruby.
|
|
96
|
-
# Revision
|
|
97
|
-
# : $Id$
|
|
98
|
-
#
|
|
99
96
|
#
|
|
100
97
|
module URI
|
|
101
|
-
#
|
|
102
|
-
# Base class for all URI classes.
|
|
103
|
-
# Implements generic URI syntax as per RFC 2396.
|
|
98
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
99
|
+
# Base class for all URI classes. Implements generic URI syntax as per RFC 2396.
|
|
104
100
|
#
|
|
105
101
|
class Generic
|
|
106
102
|
include URI
|
|
107
103
|
|
|
108
|
-
#
|
|
104
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
109
105
|
# A Default port of nil for URI::Generic.
|
|
110
106
|
#
|
|
111
107
|
DEFAULT_PORT: nil | Integer
|
|
112
108
|
|
|
113
|
-
#
|
|
109
|
+
# <!--
|
|
110
|
+
# rdoc-file=lib/uri/generic.rb
|
|
111
|
+
# - default_port()
|
|
112
|
+
# -->
|
|
114
113
|
# Returns default port.
|
|
115
114
|
#
|
|
116
115
|
def self.default_port: () -> (nil | Integer)
|
|
117
116
|
|
|
118
|
-
#
|
|
117
|
+
# <!--
|
|
118
|
+
# rdoc-file=lib/uri/generic.rb
|
|
119
|
+
# - default_port()
|
|
120
|
+
# -->
|
|
119
121
|
# Returns default port.
|
|
120
122
|
#
|
|
121
123
|
def default_port: () -> (nil | Integer)
|
|
122
124
|
|
|
123
|
-
#
|
|
125
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
124
126
|
# An Array of the available components for URI::Generic.
|
|
125
127
|
#
|
|
126
128
|
COMPONENT: Array[Symbol]
|
|
127
129
|
|
|
128
|
-
#
|
|
130
|
+
# <!--
|
|
131
|
+
# rdoc-file=lib/uri/generic.rb
|
|
132
|
+
# - component()
|
|
133
|
+
# -->
|
|
129
134
|
# Components of the URI in the order.
|
|
130
135
|
#
|
|
131
136
|
def self.component: () -> Array[Symbol]
|
|
@@ -134,12 +139,15 @@ module URI
|
|
|
134
139
|
|
|
135
140
|
def self.use_registry: () -> bool
|
|
136
141
|
|
|
137
|
-
#
|
|
138
|
-
#
|
|
142
|
+
# <!--
|
|
143
|
+
# rdoc-file=lib/uri/generic.rb
|
|
144
|
+
# - build2(args)
|
|
145
|
+
# -->
|
|
146
|
+
# ## Synopsis
|
|
139
147
|
#
|
|
140
148
|
# See ::new.
|
|
141
149
|
#
|
|
142
|
-
#
|
|
150
|
+
# ## Description
|
|
143
151
|
#
|
|
144
152
|
# At first, tries to create a new URI::Generic instance using
|
|
145
153
|
# URI::Generic::build. But, if exception URI::InvalidComponentError is raised,
|
|
@@ -148,382 +156,498 @@ module URI
|
|
|
148
156
|
def self.build2: (Array[nil | String | Integer]) -> URI::Generic
|
|
149
157
|
| ({ scheme: String, userinfo: String, host: String, port: Integer, registry: String?, path: String, opaque: String?, query: String, fragment: String }) -> URI::Generic
|
|
150
158
|
|
|
151
|
-
#
|
|
152
|
-
#
|
|
159
|
+
# <!--
|
|
160
|
+
# rdoc-file=lib/uri/generic.rb
|
|
161
|
+
# - build(args)
|
|
162
|
+
# -->
|
|
163
|
+
# ## Synopsis
|
|
153
164
|
#
|
|
154
165
|
# See ::new.
|
|
155
166
|
#
|
|
156
|
-
#
|
|
167
|
+
# ## Description
|
|
157
168
|
#
|
|
158
|
-
# Creates a new URI::Generic instance from components of URI::Generic
|
|
159
|
-
#
|
|
160
|
-
#
|
|
169
|
+
# Creates a new URI::Generic instance from components of URI::Generic with
|
|
170
|
+
# check. Components are: scheme, userinfo, host, port, registry, path, opaque,
|
|
171
|
+
# query, and fragment. You can provide arguments either by an Array or a Hash.
|
|
161
172
|
# See ::new for hash keys to use or for order of array items.
|
|
162
173
|
#
|
|
163
174
|
def self.build: (Array[nil | String | Integer]) -> URI::Generic
|
|
164
175
|
| ({ scheme: String, userinfo: String, host: String, port: Integer, registry: String?, path: String, opaque: String?, query: String, fragment: String }) -> URI::Generic
|
|
165
176
|
|
|
166
|
-
#
|
|
167
|
-
#
|
|
168
|
-
#
|
|
169
|
-
#
|
|
170
|
-
#
|
|
171
|
-
#
|
|
172
|
-
#
|
|
173
|
-
#
|
|
174
|
-
#
|
|
175
|
-
#
|
|
176
|
-
#
|
|
177
|
-
#
|
|
178
|
-
#
|
|
179
|
-
#
|
|
180
|
-
#
|
|
181
|
-
#
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
#
|
|
185
|
-
#
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
#
|
|
189
|
-
#
|
|
190
|
-
#
|
|
191
|
-
#
|
|
192
|
-
#
|
|
177
|
+
# <!--
|
|
178
|
+
# rdoc-file=lib/uri/generic.rb
|
|
179
|
+
# - new(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = DEFAULT_PARSER, arg_check = false)
|
|
180
|
+
# -->
|
|
181
|
+
# ## Args
|
|
182
|
+
#
|
|
183
|
+
# `scheme`
|
|
184
|
+
# : Protocol scheme, i.e. 'http','ftp','mailto' and so on.
|
|
185
|
+
# `userinfo`
|
|
186
|
+
# : User name and password, i.e. 'sdmitry:bla'.
|
|
187
|
+
# `host`
|
|
188
|
+
# : Server host name.
|
|
189
|
+
# `port`
|
|
190
|
+
# : Server port.
|
|
191
|
+
# `registry`
|
|
192
|
+
# : Registry of naming authorities.
|
|
193
|
+
# `path`
|
|
194
|
+
# : Path on server.
|
|
195
|
+
# `opaque`
|
|
196
|
+
# : Opaque part.
|
|
197
|
+
# `query`
|
|
198
|
+
# : Query data.
|
|
199
|
+
# `fragment`
|
|
200
|
+
# : Part of the URI after '#' character.
|
|
201
|
+
# `parser`
|
|
202
|
+
# : Parser for internal use [URI::DEFAULT_PARSER by default].
|
|
203
|
+
# `arg_check`
|
|
204
|
+
# : Check arguments [false by default].
|
|
205
|
+
#
|
|
206
|
+
#
|
|
207
|
+
# ## Description
|
|
193
208
|
#
|
|
194
209
|
# Creates a new URI::Generic instance from ``generic'' components without check.
|
|
195
210
|
#
|
|
196
211
|
def initialize: (String? scheme, String? userinfo, String? host, (String | Integer)? port, nil registry, String? path, String? opaque, String? query, String? fragment, ?untyped parser, ?boolish arg_check) -> void
|
|
197
212
|
|
|
198
|
-
#
|
|
213
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
199
214
|
# Returns the scheme component of the URI.
|
|
200
215
|
#
|
|
201
|
-
#
|
|
216
|
+
# URI("http://foo/bar/baz").scheme #=> "http"
|
|
202
217
|
#
|
|
203
218
|
attr_reader scheme: String?
|
|
204
219
|
|
|
220
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
205
221
|
# Returns the host component of the URI.
|
|
206
222
|
#
|
|
207
|
-
#
|
|
223
|
+
# URI("http://foo/bar/baz").host #=> "foo"
|
|
208
224
|
#
|
|
209
225
|
# It returns nil if no host component exists.
|
|
210
226
|
#
|
|
211
|
-
#
|
|
227
|
+
# URI("mailto:foo@example.org").host #=> nil
|
|
212
228
|
#
|
|
213
229
|
# The component does not contain the port number.
|
|
214
230
|
#
|
|
215
|
-
#
|
|
231
|
+
# URI("http://foo:8080/bar/baz").host #=> "foo"
|
|
216
232
|
#
|
|
217
|
-
# Since IPv6 addresses are wrapped with brackets in URIs,
|
|
218
|
-
#
|
|
219
|
-
#
|
|
220
|
-
#
|
|
233
|
+
# Since IPv6 addresses are wrapped with brackets in URIs, this method returns
|
|
234
|
+
# IPv6 addresses wrapped with brackets. This form is not appropriate to pass to
|
|
235
|
+
# socket methods such as TCPSocket.open. If unwrapped host names are required,
|
|
236
|
+
# use the #hostname method.
|
|
221
237
|
#
|
|
222
|
-
#
|
|
223
|
-
#
|
|
238
|
+
# URI("http://[::1]/bar/baz").host #=> "[::1]"
|
|
239
|
+
# URI("http://[::1]/bar/baz").hostname #=> "::1"
|
|
224
240
|
#
|
|
225
241
|
attr_reader host: String?
|
|
226
242
|
|
|
243
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
227
244
|
# Returns the port component of the URI.
|
|
228
245
|
#
|
|
229
|
-
#
|
|
230
|
-
#
|
|
246
|
+
# URI("http://foo/bar/baz").port #=> 80
|
|
247
|
+
# URI("http://foo:8080/bar/baz").port #=> 8080
|
|
231
248
|
#
|
|
232
249
|
attr_reader port: Integer?
|
|
233
250
|
|
|
234
251
|
def registry: () -> nil
|
|
235
252
|
|
|
253
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
236
254
|
# Returns the path component of the URI.
|
|
237
255
|
#
|
|
238
|
-
#
|
|
256
|
+
# URI("http://foo/bar/baz").path #=> "/bar/baz"
|
|
239
257
|
#
|
|
240
258
|
attr_reader path: String?
|
|
241
259
|
|
|
260
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
242
261
|
# Returns the query component of the URI.
|
|
243
262
|
#
|
|
244
|
-
#
|
|
263
|
+
# URI("http://foo/bar/baz?search=FooBar").query #=> "search=FooBar"
|
|
245
264
|
#
|
|
246
265
|
attr_reader query: String?
|
|
247
266
|
|
|
267
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
248
268
|
# Returns the opaque part of the URI.
|
|
249
269
|
#
|
|
250
|
-
#
|
|
251
|
-
#
|
|
270
|
+
# URI("mailto:foo@example.org").opaque #=> "foo@example.org"
|
|
271
|
+
# URI("http://foo/bar/baz").opaque #=> nil
|
|
252
272
|
#
|
|
253
|
-
# The portion of the path that does not make use of the slash '/'.
|
|
254
|
-
#
|
|
255
|
-
#
|
|
273
|
+
# The portion of the path that does not make use of the slash '/'. The path
|
|
274
|
+
# typically refers to an absolute path or an opaque part. (See RFC2396 Section 3
|
|
275
|
+
# and 5.2.)
|
|
256
276
|
#
|
|
257
277
|
attr_reader opaque: String?
|
|
258
278
|
|
|
279
|
+
# <!-- rdoc-file=lib/uri/generic.rb -->
|
|
259
280
|
# Returns the fragment component of the URI.
|
|
260
281
|
#
|
|
261
|
-
#
|
|
282
|
+
# URI("http://foo/bar/baz?search=FooBar#ponies").fragment #=> "ponies"
|
|
262
283
|
#
|
|
263
284
|
attr_reader fragment: String?
|
|
264
285
|
|
|
286
|
+
# <!--
|
|
287
|
+
# rdoc-file=lib/uri/generic.rb
|
|
288
|
+
# - parser()
|
|
289
|
+
# -->
|
|
265
290
|
# Returns the parser to be used.
|
|
266
291
|
#
|
|
267
292
|
# Unless a URI::Parser is defined, DEFAULT_PARSER is used.
|
|
268
293
|
#
|
|
269
294
|
def parser: () -> untyped
|
|
270
295
|
|
|
296
|
+
# <!--
|
|
297
|
+
# rdoc-file=lib/uri/generic.rb
|
|
298
|
+
# - replace!(oth)
|
|
299
|
+
# -->
|
|
271
300
|
# Replaces self by other URI object.
|
|
272
301
|
#
|
|
273
302
|
def replace!: (URI::Generic oth) -> URI::Generic
|
|
274
303
|
|
|
275
|
-
#
|
|
304
|
+
# <!--
|
|
305
|
+
# rdoc-file=lib/uri/generic.rb
|
|
306
|
+
# - component()
|
|
307
|
+
# -->
|
|
276
308
|
# Components of the URI in the order.
|
|
277
309
|
#
|
|
278
310
|
def component: () -> Array[Symbol]
|
|
279
311
|
|
|
280
|
-
#
|
|
281
|
-
#
|
|
312
|
+
# <!--
|
|
313
|
+
# rdoc-file=lib/uri/generic.rb
|
|
314
|
+
# - check_scheme(v)
|
|
315
|
+
# -->
|
|
316
|
+
# Checks the scheme `v` component against the URI::Parser Regexp for :SCHEME.
|
|
282
317
|
#
|
|
283
318
|
def check_scheme: (String? v) -> true
|
|
284
319
|
|
|
285
|
-
#
|
|
320
|
+
# <!--
|
|
321
|
+
# rdoc-file=lib/uri/generic.rb
|
|
322
|
+
# - set_scheme(v)
|
|
323
|
+
# -->
|
|
324
|
+
# Protected setter for the scheme component `v`.
|
|
286
325
|
#
|
|
287
326
|
# See also URI::Generic.scheme=.
|
|
288
327
|
#
|
|
289
328
|
def set_scheme: (String? v) -> String?
|
|
290
329
|
|
|
330
|
+
# <!--
|
|
331
|
+
# rdoc-file=lib/uri/generic.rb
|
|
332
|
+
# - scheme=(v)
|
|
333
|
+
# -->
|
|
334
|
+
# ## Args
|
|
291
335
|
#
|
|
292
|
-
#
|
|
336
|
+
# `v`
|
|
337
|
+
# : String
|
|
293
338
|
#
|
|
294
|
-
# +v+::
|
|
295
|
-
# String
|
|
296
339
|
#
|
|
297
|
-
#
|
|
340
|
+
# ## Description
|
|
298
341
|
#
|
|
299
|
-
# Public setter for the scheme component
|
|
300
|
-
# (with validation).
|
|
342
|
+
# Public setter for the scheme component `v` (with validation).
|
|
301
343
|
#
|
|
302
344
|
# See also URI::Generic.check_scheme.
|
|
303
345
|
#
|
|
304
|
-
#
|
|
346
|
+
# ## Usage
|
|
305
347
|
#
|
|
306
|
-
#
|
|
348
|
+
# require 'uri'
|
|
307
349
|
#
|
|
308
|
-
#
|
|
309
|
-
#
|
|
310
|
-
#
|
|
350
|
+
# uri = URI.parse("http://my.example.com")
|
|
351
|
+
# uri.scheme = "https"
|
|
352
|
+
# uri.to_s #=> "https://my.example.com"
|
|
311
353
|
#
|
|
312
354
|
def scheme=: (String? v) -> String?
|
|
313
355
|
|
|
356
|
+
# <!--
|
|
357
|
+
# rdoc-file=lib/uri/generic.rb
|
|
358
|
+
# - check_userinfo(user, password = nil)
|
|
359
|
+
# -->
|
|
360
|
+
# Checks the `user` and `password`.
|
|
314
361
|
#
|
|
315
|
-
#
|
|
316
|
-
#
|
|
317
|
-
# If +password+ is not provided, then +user+ is
|
|
318
|
-
# split, using URI::Generic.split_userinfo, to
|
|
319
|
-
# pull +user+ and +password.
|
|
362
|
+
# If `password` is not provided, then `user` is split, using
|
|
363
|
+
# URI::Generic.split_userinfo, to pull `user` and +password.
|
|
320
364
|
#
|
|
321
365
|
# See also URI::Generic.check_user, URI::Generic.check_password.
|
|
322
366
|
#
|
|
323
367
|
def check_userinfo: (String user, ?String? password) -> true
|
|
324
368
|
|
|
369
|
+
# <!--
|
|
370
|
+
# rdoc-file=lib/uri/generic.rb
|
|
371
|
+
# - check_user(v)
|
|
372
|
+
# -->
|
|
373
|
+
# Checks the user `v` component for RFC2396 compliance and against the
|
|
374
|
+
# URI::Parser Regexp for :USERINFO.
|
|
325
375
|
#
|
|
326
|
-
#
|
|
327
|
-
#
|
|
328
|
-
#
|
|
329
|
-
# Can not have a registry or opaque component defined,
|
|
330
|
-
# with a user component defined.
|
|
376
|
+
# Can not have a registry or opaque component defined, with a user component
|
|
377
|
+
# defined.
|
|
331
378
|
#
|
|
332
379
|
def check_user: (String v) -> (String | true)
|
|
333
380
|
|
|
381
|
+
# <!--
|
|
382
|
+
# rdoc-file=lib/uri/generic.rb
|
|
383
|
+
# - check_password(v, user = @user)
|
|
384
|
+
# -->
|
|
385
|
+
# Checks the password `v` component for RFC2396 compliance and against the
|
|
386
|
+
# URI::Parser Regexp for :USERINFO.
|
|
334
387
|
#
|
|
335
|
-
#
|
|
336
|
-
#
|
|
337
|
-
#
|
|
338
|
-
# Can not have a registry or opaque component defined,
|
|
339
|
-
# with a user component defined.
|
|
388
|
+
# Can not have a registry or opaque component defined, with a user component
|
|
389
|
+
# defined.
|
|
340
390
|
#
|
|
341
391
|
def check_password: (String? v, ?String user) -> (String? | true)
|
|
342
392
|
|
|
343
|
-
#
|
|
393
|
+
# <!--
|
|
394
|
+
# rdoc-file=lib/uri/generic.rb
|
|
395
|
+
# - userinfo=(userinfo)
|
|
396
|
+
# -->
|
|
344
397
|
# Sets userinfo, argument is string like 'name:pass'.
|
|
345
398
|
#
|
|
346
399
|
def userinfo=: (String? userinfo) -> String?
|
|
347
400
|
|
|
401
|
+
# <!--
|
|
402
|
+
# rdoc-file=lib/uri/generic.rb
|
|
403
|
+
# - user=(user)
|
|
404
|
+
# -->
|
|
405
|
+
# ## Args
|
|
348
406
|
#
|
|
349
|
-
#
|
|
407
|
+
# `v`
|
|
408
|
+
# : String
|
|
350
409
|
#
|
|
351
|
-
# +v+::
|
|
352
|
-
# String
|
|
353
410
|
#
|
|
354
|
-
#
|
|
411
|
+
# ## Description
|
|
355
412
|
#
|
|
356
|
-
# Public setter for the
|
|
357
|
-
# (with validation).
|
|
413
|
+
# Public setter for the `user` component (with validation).
|
|
358
414
|
#
|
|
359
415
|
# See also URI::Generic.check_user.
|
|
360
416
|
#
|
|
361
|
-
#
|
|
417
|
+
# ## Usage
|
|
362
418
|
#
|
|
363
|
-
#
|
|
419
|
+
# require 'uri'
|
|
364
420
|
#
|
|
365
|
-
#
|
|
366
|
-
#
|
|
367
|
-
#
|
|
421
|
+
# uri = URI.parse("http://john:S3nsit1ve@my.example.com")
|
|
422
|
+
# uri.user = "sam"
|
|
423
|
+
# uri.to_s #=> "http://sam:V3ry_S3nsit1ve@my.example.com"
|
|
368
424
|
#
|
|
369
425
|
def user=: (String? user) -> String?
|
|
370
426
|
|
|
427
|
+
# <!--
|
|
428
|
+
# rdoc-file=lib/uri/generic.rb
|
|
429
|
+
# - password=(password)
|
|
430
|
+
# -->
|
|
431
|
+
# ## Args
|
|
371
432
|
#
|
|
372
|
-
#
|
|
433
|
+
# `v`
|
|
434
|
+
# : String
|
|
373
435
|
#
|
|
374
|
-
# +v+::
|
|
375
|
-
# String
|
|
376
436
|
#
|
|
377
|
-
#
|
|
437
|
+
# ## Description
|
|
378
438
|
#
|
|
379
|
-
# Public setter for the
|
|
380
|
-
# (with validation).
|
|
439
|
+
# Public setter for the `password` component (with validation).
|
|
381
440
|
#
|
|
382
441
|
# See also URI::Generic.check_password.
|
|
383
442
|
#
|
|
384
|
-
#
|
|
443
|
+
# ## Usage
|
|
385
444
|
#
|
|
386
|
-
#
|
|
445
|
+
# require 'uri'
|
|
387
446
|
#
|
|
388
|
-
#
|
|
389
|
-
#
|
|
390
|
-
#
|
|
447
|
+
# uri = URI.parse("http://john:S3nsit1ve@my.example.com")
|
|
448
|
+
# uri.password = "V3ry_S3nsit1ve"
|
|
449
|
+
# uri.to_s #=> "http://john:V3ry_S3nsit1ve@my.example.com"
|
|
391
450
|
#
|
|
392
451
|
def password=: (String? password) -> String?
|
|
393
452
|
|
|
394
|
-
#
|
|
395
|
-
#
|
|
453
|
+
# <!--
|
|
454
|
+
# rdoc-file=lib/uri/generic.rb
|
|
455
|
+
# - set_userinfo(user, password = nil)
|
|
456
|
+
# -->
|
|
457
|
+
# Protected setter for the `user` component, and `password` if available (with
|
|
458
|
+
# validation).
|
|
396
459
|
#
|
|
397
460
|
# See also URI::Generic.userinfo=.
|
|
398
461
|
#
|
|
399
|
-
def set_userinfo: (String? user, ?String? password) -> [String?, String?]
|
|
462
|
+
def set_userinfo: (String? user, ?String? password) -> [ String?, String? ]
|
|
400
463
|
|
|
401
|
-
#
|
|
464
|
+
# <!--
|
|
465
|
+
# rdoc-file=lib/uri/generic.rb
|
|
466
|
+
# - set_user(v)
|
|
467
|
+
# -->
|
|
468
|
+
# Protected setter for the user component `v`.
|
|
402
469
|
#
|
|
403
470
|
# See also URI::Generic.user=.
|
|
404
471
|
#
|
|
405
472
|
def set_user: (String? v) -> String?
|
|
406
473
|
|
|
407
|
-
#
|
|
474
|
+
# <!--
|
|
475
|
+
# rdoc-file=lib/uri/generic.rb
|
|
476
|
+
# - set_password(v)
|
|
477
|
+
# -->
|
|
478
|
+
# Protected setter for the password component `v`.
|
|
408
479
|
#
|
|
409
480
|
# See also URI::Generic.password=.
|
|
410
481
|
#
|
|
411
482
|
def set_password: (String? v) -> String?
|
|
412
483
|
|
|
413
|
-
#
|
|
414
|
-
#
|
|
484
|
+
# <!--
|
|
485
|
+
# rdoc-file=lib/uri/generic.rb
|
|
486
|
+
# - split_userinfo(ui)
|
|
487
|
+
# -->
|
|
488
|
+
# Returns the userinfo `ui` as `[user, password]` if properly formatted as
|
|
489
|
+
# 'user:password'.
|
|
490
|
+
#
|
|
415
491
|
def split_userinfo: (String ui) -> Array[String | nil]
|
|
416
492
|
|
|
417
|
-
#
|
|
493
|
+
# <!--
|
|
494
|
+
# rdoc-file=lib/uri/generic.rb
|
|
495
|
+
# - escape_userpass(v)
|
|
496
|
+
# -->
|
|
497
|
+
# Escapes 'user:password' `v` based on RFC 1738 section 3.1.
|
|
498
|
+
#
|
|
418
499
|
def escape_userpass: (String v) -> String
|
|
419
500
|
|
|
501
|
+
# <!--
|
|
502
|
+
# rdoc-file=lib/uri/generic.rb
|
|
503
|
+
# - userinfo()
|
|
504
|
+
# -->
|
|
420
505
|
# Returns the userinfo, either as 'user' or 'user:password'.
|
|
506
|
+
#
|
|
421
507
|
def userinfo: () -> String?
|
|
422
508
|
|
|
509
|
+
# <!--
|
|
510
|
+
# rdoc-file=lib/uri/generic.rb
|
|
511
|
+
# - user()
|
|
512
|
+
# -->
|
|
423
513
|
# Returns the user component.
|
|
514
|
+
#
|
|
424
515
|
def user: () -> String?
|
|
425
516
|
|
|
517
|
+
# <!--
|
|
518
|
+
# rdoc-file=lib/uri/generic.rb
|
|
519
|
+
# - password()
|
|
520
|
+
# -->
|
|
426
521
|
# Returns the password component.
|
|
522
|
+
#
|
|
427
523
|
def password: () -> String?
|
|
428
524
|
|
|
525
|
+
# <!--
|
|
526
|
+
# rdoc-file=lib/uri/generic.rb
|
|
527
|
+
# - check_host(v)
|
|
528
|
+
# -->
|
|
529
|
+
# Checks the host `v` component for RFC2396 compliance and against the
|
|
530
|
+
# URI::Parser Regexp for :HOST.
|
|
429
531
|
#
|
|
430
|
-
#
|
|
431
|
-
#
|
|
432
|
-
#
|
|
433
|
-
# Can not have a registry or opaque component defined,
|
|
434
|
-
# with a host component defined.
|
|
532
|
+
# Can not have a registry or opaque component defined, with a host component
|
|
533
|
+
# defined.
|
|
435
534
|
#
|
|
436
535
|
def check_host: (String? v) -> true?
|
|
437
536
|
|
|
438
|
-
#
|
|
537
|
+
# <!--
|
|
538
|
+
# rdoc-file=lib/uri/generic.rb
|
|
539
|
+
# - set_host(v)
|
|
540
|
+
# -->
|
|
541
|
+
# Protected setter for the host component `v`.
|
|
439
542
|
#
|
|
440
543
|
# See also URI::Generic.host=.
|
|
441
544
|
#
|
|
442
545
|
def set_host: (String? v) -> String?
|
|
443
546
|
|
|
547
|
+
# <!--
|
|
548
|
+
# rdoc-file=lib/uri/generic.rb
|
|
549
|
+
# - host=(v)
|
|
550
|
+
# -->
|
|
551
|
+
# ## Args
|
|
444
552
|
#
|
|
445
|
-
#
|
|
553
|
+
# `v`
|
|
554
|
+
# : String
|
|
446
555
|
#
|
|
447
|
-
# +v+::
|
|
448
|
-
# String
|
|
449
556
|
#
|
|
450
|
-
#
|
|
557
|
+
# ## Description
|
|
451
558
|
#
|
|
452
|
-
# Public setter for the host component
|
|
453
|
-
# (with validation).
|
|
559
|
+
# Public setter for the host component `v` (with validation).
|
|
454
560
|
#
|
|
455
561
|
# See also URI::Generic.check_host.
|
|
456
562
|
#
|
|
457
|
-
#
|
|
563
|
+
# ## Usage
|
|
458
564
|
#
|
|
459
|
-
#
|
|
565
|
+
# require 'uri'
|
|
460
566
|
#
|
|
461
|
-
#
|
|
462
|
-
#
|
|
463
|
-
#
|
|
567
|
+
# uri = URI.parse("http://my.example.com")
|
|
568
|
+
# uri.host = "foo.com"
|
|
569
|
+
# uri.to_s #=> "http://foo.com"
|
|
464
570
|
#
|
|
465
571
|
def host=: (String? v) -> String?
|
|
466
572
|
|
|
573
|
+
# <!--
|
|
574
|
+
# rdoc-file=lib/uri/generic.rb
|
|
575
|
+
# - hostname()
|
|
576
|
+
# -->
|
|
467
577
|
# Extract the host part of the URI and unwrap brackets for IPv6 addresses.
|
|
468
578
|
#
|
|
469
|
-
# This method is the same as URI::Generic#host except
|
|
470
|
-
#
|
|
579
|
+
# This method is the same as URI::Generic#host except brackets for IPv6 (and
|
|
580
|
+
# future IP) addresses are removed.
|
|
471
581
|
#
|
|
472
|
-
#
|
|
473
|
-
#
|
|
474
|
-
#
|
|
582
|
+
# uri = URI("http://[::1]/bar")
|
|
583
|
+
# uri.hostname #=> "::1"
|
|
584
|
+
# uri.host #=> "[::1]"
|
|
475
585
|
#
|
|
476
586
|
def hostname: () -> String?
|
|
477
587
|
|
|
478
|
-
#
|
|
588
|
+
# <!--
|
|
589
|
+
# rdoc-file=lib/uri/generic.rb
|
|
590
|
+
# - hostname=(v)
|
|
591
|
+
# -->
|
|
592
|
+
# Sets the host part of the URI as the argument with brackets for IPv6
|
|
593
|
+
# addresses.
|
|
479
594
|
#
|
|
480
|
-
# This method is the same as URI::Generic#host= except
|
|
481
|
-
#
|
|
595
|
+
# This method is the same as URI::Generic#host= except the argument can be a
|
|
596
|
+
# bare IPv6 address.
|
|
482
597
|
#
|
|
483
|
-
#
|
|
484
|
-
#
|
|
485
|
-
#
|
|
598
|
+
# uri = URI("http://foo/bar")
|
|
599
|
+
# uri.hostname = "::1"
|
|
600
|
+
# uri.to_s #=> "http://[::1]/bar"
|
|
486
601
|
#
|
|
487
|
-
# If the argument seems to be an IPv6 address,
|
|
488
|
-
# it is wrapped with brackets.
|
|
602
|
+
# If the argument seems to be an IPv6 address, it is wrapped with brackets.
|
|
489
603
|
#
|
|
490
604
|
def hostname=: (String? v) -> String?
|
|
491
605
|
|
|
606
|
+
# <!--
|
|
607
|
+
# rdoc-file=lib/uri/generic.rb
|
|
608
|
+
# - check_port(v)
|
|
609
|
+
# -->
|
|
610
|
+
# Checks the port `v` component for RFC2396 compliance and against the
|
|
611
|
+
# URI::Parser Regexp for :PORT.
|
|
492
612
|
#
|
|
493
|
-
#
|
|
494
|
-
#
|
|
495
|
-
#
|
|
496
|
-
# Can not have a registry or opaque component defined,
|
|
497
|
-
# with a port component defined.
|
|
613
|
+
# Can not have a registry or opaque component defined, with a port component
|
|
614
|
+
# defined.
|
|
498
615
|
#
|
|
499
616
|
def check_port: ((String | Integer)? v) -> true?
|
|
500
617
|
|
|
501
|
-
#
|
|
618
|
+
# <!--
|
|
619
|
+
# rdoc-file=lib/uri/generic.rb
|
|
620
|
+
# - set_port(v)
|
|
621
|
+
# -->
|
|
622
|
+
# Protected setter for the port component `v`.
|
|
502
623
|
#
|
|
503
624
|
# See also URI::Generic.port=.
|
|
504
625
|
#
|
|
505
626
|
def set_port: ((String | Integer)? v) -> (String | Integer)?
|
|
506
627
|
|
|
628
|
+
# <!--
|
|
629
|
+
# rdoc-file=lib/uri/generic.rb
|
|
630
|
+
# - port=(v)
|
|
631
|
+
# -->
|
|
632
|
+
# ## Args
|
|
507
633
|
#
|
|
508
|
-
#
|
|
634
|
+
# `v`
|
|
635
|
+
# : String
|
|
509
636
|
#
|
|
510
|
-
# +v+::
|
|
511
|
-
# String
|
|
512
637
|
#
|
|
513
|
-
#
|
|
638
|
+
# ## Description
|
|
514
639
|
#
|
|
515
|
-
# Public setter for the port component
|
|
516
|
-
# (with validation).
|
|
640
|
+
# Public setter for the port component `v` (with validation).
|
|
517
641
|
#
|
|
518
642
|
# See also URI::Generic.check_port.
|
|
519
643
|
#
|
|
520
|
-
#
|
|
644
|
+
# ## Usage
|
|
521
645
|
#
|
|
522
|
-
#
|
|
646
|
+
# require 'uri'
|
|
523
647
|
#
|
|
524
|
-
#
|
|
525
|
-
#
|
|
526
|
-
#
|
|
648
|
+
# uri = URI.parse("http://my.example.com")
|
|
649
|
+
# uri.port = 8080
|
|
650
|
+
# uri.to_s #=> "http://my.example.com:8080"
|
|
527
651
|
#
|
|
528
652
|
def port=: ((String | Integer)? v) -> (String | Integer)?
|
|
529
653
|
|
|
@@ -531,202 +655,256 @@ module URI
|
|
|
531
655
|
|
|
532
656
|
def set_registry: (String v) -> nil
|
|
533
657
|
|
|
658
|
+
# <!--
|
|
659
|
+
# rdoc-file=lib/uri/generic.rb
|
|
660
|
+
# - registry=(v)
|
|
661
|
+
# -->
|
|
662
|
+
#
|
|
534
663
|
def registry=: (String v) -> nil
|
|
535
664
|
|
|
665
|
+
# <!--
|
|
666
|
+
# rdoc-file=lib/uri/generic.rb
|
|
667
|
+
# - check_path(v)
|
|
668
|
+
# -->
|
|
669
|
+
# Checks the path `v` component for RFC2396 compliance and against the
|
|
670
|
+
# URI::Parser Regexp for :ABS_PATH and :REL_PATH.
|
|
536
671
|
#
|
|
537
|
-
#
|
|
538
|
-
# and against the URI::Parser Regexp
|
|
539
|
-
# for :ABS_PATH and :REL_PATH.
|
|
540
|
-
#
|
|
541
|
-
# Can not have a opaque component defined,
|
|
542
|
-
# with a path component defined.
|
|
672
|
+
# Can not have a opaque component defined, with a path component defined.
|
|
543
673
|
#
|
|
544
674
|
def check_path: (String? v) -> true
|
|
545
675
|
|
|
546
|
-
#
|
|
676
|
+
# <!--
|
|
677
|
+
# rdoc-file=lib/uri/generic.rb
|
|
678
|
+
# - set_path(v)
|
|
679
|
+
# -->
|
|
680
|
+
# Protected setter for the path component `v`.
|
|
547
681
|
#
|
|
548
682
|
# See also URI::Generic.path=.
|
|
549
683
|
#
|
|
550
684
|
def set_path: (String? v) -> String?
|
|
551
685
|
|
|
686
|
+
# <!--
|
|
687
|
+
# rdoc-file=lib/uri/generic.rb
|
|
688
|
+
# - path=(v)
|
|
689
|
+
# -->
|
|
690
|
+
# ## Args
|
|
552
691
|
#
|
|
553
|
-
#
|
|
692
|
+
# `v`
|
|
693
|
+
# : String
|
|
554
694
|
#
|
|
555
|
-
# +v+::
|
|
556
|
-
# String
|
|
557
695
|
#
|
|
558
|
-
#
|
|
696
|
+
# ## Description
|
|
559
697
|
#
|
|
560
|
-
# Public setter for the path component
|
|
561
|
-
# (with validation).
|
|
698
|
+
# Public setter for the path component `v` (with validation).
|
|
562
699
|
#
|
|
563
700
|
# See also URI::Generic.check_path.
|
|
564
701
|
#
|
|
565
|
-
#
|
|
702
|
+
# ## Usage
|
|
566
703
|
#
|
|
567
|
-
#
|
|
704
|
+
# require 'uri'
|
|
568
705
|
#
|
|
569
|
-
#
|
|
570
|
-
#
|
|
571
|
-
#
|
|
706
|
+
# uri = URI.parse("http://my.example.com/pub/files")
|
|
707
|
+
# uri.path = "/faq/"
|
|
708
|
+
# uri.to_s #=> "http://my.example.com/faq/"
|
|
572
709
|
#
|
|
573
710
|
def path=: (String? v) -> String?
|
|
574
711
|
|
|
712
|
+
# <!--
|
|
713
|
+
# rdoc-file=lib/uri/generic.rb
|
|
714
|
+
# - query=(v)
|
|
715
|
+
# -->
|
|
716
|
+
# ## Args
|
|
575
717
|
#
|
|
576
|
-
#
|
|
718
|
+
# `v`
|
|
719
|
+
# : String
|
|
577
720
|
#
|
|
578
|
-
# +v+::
|
|
579
|
-
# String
|
|
580
721
|
#
|
|
581
|
-
#
|
|
722
|
+
# ## Description
|
|
582
723
|
#
|
|
583
|
-
# Public setter for the query component
|
|
724
|
+
# Public setter for the query component `v`.
|
|
584
725
|
#
|
|
585
|
-
#
|
|
726
|
+
# ## Usage
|
|
586
727
|
#
|
|
587
|
-
#
|
|
728
|
+
# require 'uri'
|
|
588
729
|
#
|
|
589
|
-
#
|
|
590
|
-
#
|
|
591
|
-
#
|
|
730
|
+
# uri = URI.parse("http://my.example.com/?id=25")
|
|
731
|
+
# uri.query = "id=1"
|
|
732
|
+
# uri.to_s #=> "http://my.example.com/?id=1"
|
|
592
733
|
#
|
|
593
734
|
def query=: (String? v) -> String?
|
|
594
735
|
|
|
736
|
+
# <!--
|
|
737
|
+
# rdoc-file=lib/uri/generic.rb
|
|
738
|
+
# - check_opaque(v)
|
|
739
|
+
# -->
|
|
740
|
+
# Checks the opaque `v` component for RFC2396 compliance and against the
|
|
741
|
+
# URI::Parser Regexp for :OPAQUE.
|
|
595
742
|
#
|
|
596
|
-
#
|
|
597
|
-
#
|
|
598
|
-
#
|
|
599
|
-
# Can not have a host, port, user, or path component defined,
|
|
600
|
-
# with an opaque component defined.
|
|
743
|
+
# Can not have a host, port, user, or path component defined, with an opaque
|
|
744
|
+
# component defined.
|
|
601
745
|
#
|
|
602
746
|
def check_opaque: (String? v) -> true?
|
|
603
747
|
|
|
604
|
-
#
|
|
748
|
+
# <!--
|
|
749
|
+
# rdoc-file=lib/uri/generic.rb
|
|
750
|
+
# - set_opaque(v)
|
|
751
|
+
# -->
|
|
752
|
+
# Protected setter for the opaque component `v`.
|
|
605
753
|
#
|
|
606
754
|
# See also URI::Generic.opaque=.
|
|
607
755
|
#
|
|
608
756
|
def set_opaque: (String? v) -> String?
|
|
609
757
|
|
|
758
|
+
# <!--
|
|
759
|
+
# rdoc-file=lib/uri/generic.rb
|
|
760
|
+
# - opaque=(v)
|
|
761
|
+
# -->
|
|
762
|
+
# ## Args
|
|
610
763
|
#
|
|
611
|
-
#
|
|
764
|
+
# `v`
|
|
765
|
+
# : String
|
|
612
766
|
#
|
|
613
|
-
# +v+::
|
|
614
|
-
# String
|
|
615
767
|
#
|
|
616
|
-
#
|
|
768
|
+
# ## Description
|
|
617
769
|
#
|
|
618
|
-
# Public setter for the opaque component
|
|
619
|
-
# (with validation).
|
|
770
|
+
# Public setter for the opaque component `v` (with validation).
|
|
620
771
|
#
|
|
621
772
|
# See also URI::Generic.check_opaque.
|
|
622
773
|
#
|
|
623
774
|
def opaque=: (String? v) -> String?
|
|
624
775
|
|
|
776
|
+
# <!--
|
|
777
|
+
# rdoc-file=lib/uri/generic.rb
|
|
778
|
+
# - fragment=(v)
|
|
779
|
+
# -->
|
|
780
|
+
# Checks the fragment `v` component against the URI::Parser Regexp for
|
|
781
|
+
# :FRAGMENT.
|
|
625
782
|
#
|
|
626
|
-
#
|
|
627
|
-
#
|
|
783
|
+
# ## Args
|
|
628
784
|
#
|
|
629
|
-
#
|
|
785
|
+
# `v`
|
|
786
|
+
# : String
|
|
630
787
|
#
|
|
631
|
-
# +v+::
|
|
632
|
-
# String
|
|
633
788
|
#
|
|
634
|
-
#
|
|
789
|
+
# ## Description
|
|
635
790
|
#
|
|
636
|
-
# Public setter for the fragment component
|
|
637
|
-
# (with validation).
|
|
791
|
+
# Public setter for the fragment component `v` (with validation).
|
|
638
792
|
#
|
|
639
|
-
#
|
|
793
|
+
# ## Usage
|
|
640
794
|
#
|
|
641
|
-
#
|
|
795
|
+
# require 'uri'
|
|
642
796
|
#
|
|
643
|
-
#
|
|
644
|
-
#
|
|
645
|
-
#
|
|
797
|
+
# uri = URI.parse("http://my.example.com/?id=25#time=1305212049")
|
|
798
|
+
# uri.fragment = "time=1305212086"
|
|
799
|
+
# uri.to_s #=> "http://my.example.com/?id=25#time=1305212086"
|
|
646
800
|
#
|
|
647
801
|
def fragment=: (String? v) -> String?
|
|
648
802
|
|
|
649
|
-
#
|
|
803
|
+
# <!--
|
|
804
|
+
# rdoc-file=lib/uri/generic.rb
|
|
805
|
+
# - hierarchical?()
|
|
806
|
+
# -->
|
|
650
807
|
# Returns true if URI is hierarchical.
|
|
651
808
|
#
|
|
652
|
-
#
|
|
809
|
+
# ## Description
|
|
653
810
|
#
|
|
654
|
-
# URI has components listed in order of decreasing significance from left to
|
|
655
|
-
# see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3.
|
|
811
|
+
# URI has components listed in order of decreasing significance from left to
|
|
812
|
+
# right, see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3.
|
|
656
813
|
#
|
|
657
|
-
#
|
|
814
|
+
# ## Usage
|
|
658
815
|
#
|
|
659
|
-
#
|
|
816
|
+
# require 'uri'
|
|
660
817
|
#
|
|
661
|
-
#
|
|
662
|
-
#
|
|
663
|
-
#
|
|
664
|
-
#
|
|
665
|
-
#
|
|
666
|
-
#
|
|
818
|
+
# uri = URI.parse("http://my.example.com/")
|
|
819
|
+
# uri.hierarchical?
|
|
820
|
+
# #=> true
|
|
821
|
+
# uri = URI.parse("mailto:joe@example.com")
|
|
822
|
+
# uri.hierarchical?
|
|
823
|
+
# #=> false
|
|
667
824
|
#
|
|
668
825
|
def hierarchical?: () -> bool
|
|
669
826
|
|
|
670
|
-
#
|
|
827
|
+
# <!--
|
|
828
|
+
# rdoc-file=lib/uri/generic.rb
|
|
829
|
+
# - absolute?()
|
|
830
|
+
# -->
|
|
671
831
|
# Returns true if URI has a scheme (e.g. http:// or https://) specified.
|
|
672
832
|
#
|
|
673
833
|
def absolute?: () -> bool
|
|
674
834
|
|
|
675
|
-
#
|
|
676
|
-
#
|
|
835
|
+
# <!--
|
|
836
|
+
# rdoc-file=lib/uri/generic.rb
|
|
837
|
+
# - relative?()
|
|
838
|
+
# -->
|
|
839
|
+
# Returns true if URI does not have a scheme (e.g. http:// or https://)
|
|
840
|
+
# specified.
|
|
677
841
|
#
|
|
678
842
|
def relative?: () -> bool
|
|
679
843
|
|
|
680
|
-
#
|
|
844
|
+
# <!--
|
|
845
|
+
# rdoc-file=lib/uri/generic.rb
|
|
846
|
+
# - split_path(path)
|
|
847
|
+
# -->
|
|
681
848
|
# Returns an Array of the path split on '/'.
|
|
682
849
|
#
|
|
683
850
|
def split_path: (String path) -> Array[String]
|
|
684
851
|
|
|
685
|
-
#
|
|
686
|
-
#
|
|
687
|
-
#
|
|
852
|
+
# <!--
|
|
853
|
+
# rdoc-file=lib/uri/generic.rb
|
|
854
|
+
# - merge_path(base, rel)
|
|
855
|
+
# -->
|
|
856
|
+
# Merges a base path `base`, with relative path `rel`, returns a modified base
|
|
857
|
+
# path.
|
|
688
858
|
#
|
|
689
859
|
def merge_path: (String base, String rel) -> String
|
|
690
860
|
|
|
861
|
+
# <!--
|
|
862
|
+
# rdoc-file=lib/uri/generic.rb
|
|
863
|
+
# - merge!(oth)
|
|
864
|
+
# -->
|
|
865
|
+
# ## Args
|
|
691
866
|
#
|
|
692
|
-
#
|
|
867
|
+
# `oth`
|
|
868
|
+
# : URI or String
|
|
693
869
|
#
|
|
694
|
-
# +oth+::
|
|
695
|
-
# URI or String
|
|
696
870
|
#
|
|
697
|
-
#
|
|
871
|
+
# ## Description
|
|
698
872
|
#
|
|
699
873
|
# Destructive form of #merge.
|
|
700
874
|
#
|
|
701
|
-
#
|
|
875
|
+
# ## Usage
|
|
702
876
|
#
|
|
703
|
-
#
|
|
877
|
+
# require 'uri'
|
|
704
878
|
#
|
|
705
|
-
#
|
|
706
|
-
#
|
|
707
|
-
#
|
|
879
|
+
# uri = URI.parse("http://my.example.com")
|
|
880
|
+
# uri.merge!("/main.rbx?page=1")
|
|
881
|
+
# uri.to_s # => "http://my.example.com/main.rbx?page=1"
|
|
708
882
|
#
|
|
709
|
-
def merge!: (string oth) -> String
|
|
883
|
+
def merge!: (URI::Generic | string oth) -> String
|
|
710
884
|
|
|
885
|
+
# <!--
|
|
886
|
+
# rdoc-file=lib/uri/generic.rb
|
|
887
|
+
# - merge(oth)
|
|
888
|
+
# -->
|
|
889
|
+
# ## Args
|
|
711
890
|
#
|
|
712
|
-
#
|
|
891
|
+
# `oth`
|
|
892
|
+
# : URI or String
|
|
713
893
|
#
|
|
714
|
-
# +oth+::
|
|
715
|
-
# URI or String
|
|
716
894
|
#
|
|
717
|
-
#
|
|
895
|
+
# ## Description
|
|
718
896
|
#
|
|
719
897
|
# Merges two URIs.
|
|
720
898
|
#
|
|
721
|
-
#
|
|
899
|
+
# ## Usage
|
|
722
900
|
#
|
|
723
|
-
#
|
|
901
|
+
# require 'uri'
|
|
724
902
|
#
|
|
725
|
-
#
|
|
726
|
-
#
|
|
727
|
-
#
|
|
903
|
+
# uri = URI.parse("http://my.example.com")
|
|
904
|
+
# uri.merge("/main.rbx?page=1")
|
|
905
|
+
# # => "http://my.example.com/main.rbx?page=1"
|
|
728
906
|
#
|
|
729
|
-
def merge: (string oth) -> URI::Generic
|
|
907
|
+
def merge: (URI::Generic | string oth) -> URI::Generic
|
|
730
908
|
|
|
731
909
|
# :stopdoc:
|
|
732
910
|
def route_from_path: (String src, String dst) -> String
|
|
@@ -734,140 +912,191 @@ module URI
|
|
|
734
912
|
# :stopdoc:
|
|
735
913
|
def route_from0: (String oth) -> Array[URI::Generic]
|
|
736
914
|
|
|
915
|
+
# <!--
|
|
916
|
+
# rdoc-file=lib/uri/generic.rb
|
|
917
|
+
# - route_from(oth)
|
|
918
|
+
# -->
|
|
919
|
+
# ## Args
|
|
737
920
|
#
|
|
738
|
-
#
|
|
921
|
+
# `oth`
|
|
922
|
+
# : URI or String
|
|
739
923
|
#
|
|
740
|
-
# +oth+::
|
|
741
|
-
# URI or String
|
|
742
924
|
#
|
|
743
|
-
#
|
|
925
|
+
# ## Description
|
|
744
926
|
#
|
|
745
927
|
# Calculates relative path from oth to self.
|
|
746
928
|
#
|
|
747
|
-
#
|
|
929
|
+
# ## Usage
|
|
748
930
|
#
|
|
749
|
-
#
|
|
931
|
+
# require 'uri'
|
|
750
932
|
#
|
|
751
|
-
#
|
|
752
|
-
#
|
|
753
|
-
#
|
|
933
|
+
# uri = URI.parse('http://my.example.com/main.rbx?page=1')
|
|
934
|
+
# uri.route_from('http://my.example.com')
|
|
935
|
+
# #=> #<URI::Generic /main.rbx?page=1>
|
|
754
936
|
#
|
|
755
937
|
def route_from: (String oth) -> URI::Generic
|
|
756
938
|
|
|
939
|
+
# <!--
|
|
940
|
+
# rdoc-file=lib/uri/generic.rb
|
|
941
|
+
# - route_to(oth)
|
|
942
|
+
# -->
|
|
943
|
+
# ## Args
|
|
757
944
|
#
|
|
758
|
-
#
|
|
945
|
+
# `oth`
|
|
946
|
+
# : URI or String
|
|
759
947
|
#
|
|
760
|
-
# +oth+::
|
|
761
|
-
# URI or String
|
|
762
948
|
#
|
|
763
|
-
#
|
|
949
|
+
# ## Description
|
|
764
950
|
#
|
|
765
951
|
# Calculates relative path to oth from self.
|
|
766
952
|
#
|
|
767
|
-
#
|
|
953
|
+
# ## Usage
|
|
768
954
|
#
|
|
769
|
-
#
|
|
955
|
+
# require 'uri'
|
|
770
956
|
#
|
|
771
|
-
#
|
|
772
|
-
#
|
|
773
|
-
#
|
|
957
|
+
# uri = URI.parse('http://my.example.com')
|
|
958
|
+
# uri.route_to('http://my.example.com/main.rbx?page=1')
|
|
959
|
+
# #=> #<URI::Generic /main.rbx?page=1>
|
|
774
960
|
#
|
|
775
961
|
def route_to: (String oth) -> URI::Generic
|
|
776
962
|
|
|
777
|
-
#
|
|
963
|
+
# <!--
|
|
964
|
+
# rdoc-file=lib/uri/generic.rb
|
|
965
|
+
# - normalize()
|
|
966
|
+
# -->
|
|
778
967
|
# Returns normalized URI.
|
|
779
968
|
#
|
|
780
|
-
#
|
|
969
|
+
# require 'uri'
|
|
781
970
|
#
|
|
782
|
-
#
|
|
783
|
-
#
|
|
971
|
+
# URI("HTTP://my.EXAMPLE.com").normalize
|
|
972
|
+
# #=> #<URI::HTTP http://my.example.com/>
|
|
784
973
|
#
|
|
785
974
|
# Normalization here means:
|
|
786
975
|
#
|
|
787
|
-
# *
|
|
788
|
-
# *
|
|
976
|
+
# * scheme and host are converted to lowercase,
|
|
977
|
+
# * an empty path component is set to "/".
|
|
789
978
|
#
|
|
790
979
|
def normalize: () -> untyped
|
|
791
980
|
|
|
792
|
-
#
|
|
981
|
+
# <!--
|
|
982
|
+
# rdoc-file=lib/uri/generic.rb
|
|
983
|
+
# - normalize!()
|
|
984
|
+
# -->
|
|
793
985
|
# Destructive version of #normalize.
|
|
794
986
|
#
|
|
795
987
|
def normalize!: () -> untyped
|
|
796
988
|
|
|
797
|
-
#
|
|
989
|
+
# <!--
|
|
990
|
+
# rdoc-file=lib/uri/generic.rb
|
|
991
|
+
# - to_s()
|
|
992
|
+
# -->
|
|
798
993
|
# Constructs String from URI.
|
|
799
994
|
#
|
|
800
995
|
def to_s: () -> String
|
|
801
996
|
|
|
802
|
-
#
|
|
997
|
+
# <!--
|
|
998
|
+
# rdoc-file=lib/uri/generic.rb
|
|
999
|
+
# - ==(oth)
|
|
1000
|
+
# -->
|
|
803
1001
|
# Compares two URIs.
|
|
804
1002
|
#
|
|
805
1003
|
def ==: (URI::Generic oth) -> bool
|
|
806
1004
|
|
|
1005
|
+
# <!--
|
|
1006
|
+
# rdoc-file=lib/uri/generic.rb
|
|
1007
|
+
# - hash()
|
|
1008
|
+
# -->
|
|
1009
|
+
#
|
|
807
1010
|
def hash: () -> Integer
|
|
808
1011
|
|
|
1012
|
+
# <!--
|
|
1013
|
+
# rdoc-file=lib/uri/generic.rb
|
|
1014
|
+
# - eql?(oth)
|
|
1015
|
+
# -->
|
|
1016
|
+
#
|
|
809
1017
|
def eql?: (URI::Generic oth) -> bool
|
|
810
1018
|
|
|
1019
|
+
# <!--
|
|
1020
|
+
# rdoc-file=lib/uri/generic.rb
|
|
1021
|
+
# - component_ary()
|
|
1022
|
+
# -->
|
|
811
1023
|
# Returns an Array of the components defined from the COMPONENT Array.
|
|
1024
|
+
#
|
|
812
1025
|
def component_ary: () -> Array[nil | String | Integer]
|
|
813
1026
|
|
|
814
|
-
#
|
|
1027
|
+
# <!--
|
|
1028
|
+
# rdoc-file=lib/uri/generic.rb
|
|
1029
|
+
# - select(*components)
|
|
1030
|
+
# -->
|
|
1031
|
+
# ## Args
|
|
1032
|
+
#
|
|
1033
|
+
# `components`
|
|
1034
|
+
# : Multiple Symbol arguments defined in URI::HTTP.
|
|
815
1035
|
#
|
|
816
|
-
# +components+::
|
|
817
|
-
# Multiple Symbol arguments defined in URI::HTTP.
|
|
818
1036
|
#
|
|
819
|
-
#
|
|
1037
|
+
# ## Description
|
|
820
1038
|
#
|
|
821
1039
|
# Selects specified components from URI.
|
|
822
1040
|
#
|
|
823
|
-
#
|
|
1041
|
+
# ## Usage
|
|
824
1042
|
#
|
|
825
|
-
#
|
|
1043
|
+
# require 'uri'
|
|
826
1044
|
#
|
|
827
|
-
#
|
|
828
|
-
#
|
|
829
|
-
#
|
|
1045
|
+
# uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx')
|
|
1046
|
+
# uri.select(:userinfo, :host, :path)
|
|
1047
|
+
# # => ["myuser:mypass", "my.example.com", "/test.rbx"]
|
|
830
1048
|
#
|
|
831
1049
|
def select: (*Symbol components) -> Array[nil | String | Integer]
|
|
832
1050
|
|
|
1051
|
+
# <!--
|
|
1052
|
+
# rdoc-file=lib/uri/generic.rb
|
|
1053
|
+
# - inspect()
|
|
1054
|
+
# -->
|
|
1055
|
+
#
|
|
833
1056
|
def inspect: () -> String
|
|
834
1057
|
|
|
1058
|
+
# <!--
|
|
1059
|
+
# rdoc-file=lib/uri/generic.rb
|
|
1060
|
+
# - coerce(oth)
|
|
1061
|
+
# -->
|
|
1062
|
+
# ## Args
|
|
835
1063
|
#
|
|
836
|
-
#
|
|
1064
|
+
# `v`
|
|
1065
|
+
# : URI or String
|
|
837
1066
|
#
|
|
838
|
-
# +v+::
|
|
839
|
-
# URI or String
|
|
840
1067
|
#
|
|
841
|
-
#
|
|
1068
|
+
# ## Description
|
|
842
1069
|
#
|
|
843
|
-
# Attempts to parse other URI
|
|
844
|
-
# returns [parsed_oth, self].
|
|
1070
|
+
# Attempts to parse other URI `oth`, returns [parsed_oth, self].
|
|
845
1071
|
#
|
|
846
|
-
#
|
|
1072
|
+
# ## Usage
|
|
847
1073
|
#
|
|
848
|
-
#
|
|
1074
|
+
# require 'uri'
|
|
849
1075
|
#
|
|
850
|
-
#
|
|
851
|
-
#
|
|
852
|
-
#
|
|
1076
|
+
# uri = URI.parse("http://my.example.com")
|
|
1077
|
+
# uri.coerce("http://foo.com")
|
|
1078
|
+
# #=> [#<URI::HTTP http://foo.com>, #<URI::HTTP http://my.example.com>]
|
|
853
1079
|
#
|
|
854
1080
|
def coerce: (URI::Generic | String oth) -> Array[URI::Generic]
|
|
855
1081
|
|
|
856
|
-
#
|
|
857
|
-
#
|
|
858
|
-
#
|
|
859
|
-
#
|
|
1082
|
+
# <!--
|
|
1083
|
+
# rdoc-file=lib/uri/generic.rb
|
|
1084
|
+
# - find_proxy(env=ENV)
|
|
1085
|
+
# -->
|
|
1086
|
+
# Returns a proxy URI. The proxy URI is obtained from environment variables such
|
|
1087
|
+
# as http_proxy, ftp_proxy, no_proxy, etc. If there is no proper proxy, nil is
|
|
1088
|
+
# returned.
|
|
1089
|
+
#
|
|
1090
|
+
# If the optional parameter `env` is specified, it is used instead of ENV.
|
|
860
1091
|
#
|
|
861
|
-
#
|
|
1092
|
+
# Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.) are
|
|
1093
|
+
# examined, too.
|
|
862
1094
|
#
|
|
863
|
-
#
|
|
864
|
-
#
|
|
1095
|
+
# But http_proxy and HTTP_PROXY is treated specially under CGI environment. It's
|
|
1096
|
+
# because HTTP_PROXY may be set by Proxy: header. So HTTP_PROXY is not used.
|
|
1097
|
+
# http_proxy is not used too if the variable is case insensitive. CGI_HTTP_PROXY
|
|
1098
|
+
# can be used instead.
|
|
865
1099
|
#
|
|
866
|
-
# But http_proxy and HTTP_PROXY is treated specially under CGI environment.
|
|
867
|
-
# It's because HTTP_PROXY may be set by Proxy: header.
|
|
868
|
-
# So HTTP_PROXY is not used.
|
|
869
|
-
# http_proxy is not used too if the variable is case insensitive.
|
|
870
|
-
# CGI_HTTP_PROXY can be used instead.
|
|
871
1100
|
def find_proxy: (?String env) -> (nil | URI::Generic)
|
|
872
1101
|
|
|
873
1102
|
def self.use_proxy?: (String hostname, String addr, Integer port, String no_proxy) -> bool
|