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/http.rbs
CHANGED
|
@@ -1,131 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
# ([RFC2396](http://tools.ietf.org/html/rfc2396)).
|
|
3
|
-
#
|
|
4
|
-
# ## Features
|
|
5
|
-
#
|
|
6
|
-
# * Uniform way of handling URIs.
|
|
7
|
-
# * Flexibility to introduce custom URI schemes.
|
|
8
|
-
# * Flexibility to have an alternate URI::Parser (or just different patterns
|
|
9
|
-
# and regexp's).
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# ## Basic example
|
|
13
|
-
#
|
|
14
|
-
# require 'uri'
|
|
15
|
-
#
|
|
16
|
-
# uri = URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
|
|
17
|
-
# #=> #<URI::HTTP http://foo.com/posts?id=30&limit=5#time=1305298413>
|
|
18
|
-
#
|
|
19
|
-
# uri.scheme #=> "http"
|
|
20
|
-
# uri.host #=> "foo.com"
|
|
21
|
-
# uri.path #=> "/posts"
|
|
22
|
-
# uri.query #=> "id=30&limit=5"
|
|
23
|
-
# uri.fragment #=> "time=1305298413"
|
|
24
|
-
#
|
|
25
|
-
# uri.to_s #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"
|
|
26
|
-
#
|
|
27
|
-
# ## Adding custom URIs
|
|
28
|
-
#
|
|
29
|
-
# module URI
|
|
30
|
-
# class RSYNC < Generic
|
|
31
|
-
# DEFAULT_PORT = 873
|
|
32
|
-
# end
|
|
33
|
-
# @@schemes['RSYNC'] = RSYNC
|
|
34
|
-
# end
|
|
35
|
-
# #=> URI::RSYNC
|
|
36
|
-
#
|
|
37
|
-
# URI.scheme_list
|
|
38
|
-
# #=> {"FILE"=>URI::File, "FTP"=>URI::FTP, "HTTP"=>URI::HTTP,
|
|
39
|
-
# # "HTTPS"=>URI::HTTPS, "LDAP"=>URI::LDAP, "LDAPS"=>URI::LDAPS,
|
|
40
|
-
# # "MAILTO"=>URI::MailTo, "RSYNC"=>URI::RSYNC}
|
|
41
|
-
#
|
|
42
|
-
# uri = URI("rsync://rsync.foo.com")
|
|
43
|
-
# #=> #<URI::RSYNC rsync://rsync.foo.com>
|
|
44
|
-
#
|
|
45
|
-
# ## RFC References
|
|
46
|
-
#
|
|
47
|
-
# A good place to view an RFC spec is http://www.ietf.org/rfc.html.
|
|
48
|
-
#
|
|
49
|
-
# Here is a list of all related RFC's:
|
|
50
|
-
# * [RFC822](http://tools.ietf.org/html/rfc822)
|
|
51
|
-
# * [RFC1738](http://tools.ietf.org/html/rfc1738)
|
|
52
|
-
# * [RFC2255](http://tools.ietf.org/html/rfc2255)
|
|
53
|
-
# * [RFC2368](http://tools.ietf.org/html/rfc2368)
|
|
54
|
-
# * [RFC2373](http://tools.ietf.org/html/rfc2373)
|
|
55
|
-
# * [RFC2396](http://tools.ietf.org/html/rfc2396)
|
|
56
|
-
# * [RFC2732](http://tools.ietf.org/html/rfc2732)
|
|
57
|
-
# * [RFC3986](http://tools.ietf.org/html/rfc3986)
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
# ## Class tree
|
|
61
|
-
#
|
|
62
|
-
# * URI::Generic (in uri/generic.rb)
|
|
63
|
-
# * URI::File - (in uri/file.rb)
|
|
64
|
-
# * URI::FTP - (in uri/ftp.rb)
|
|
65
|
-
# * URI::HTTP - (in uri/http.rb)
|
|
66
|
-
# * URI::HTTPS - (in uri/https.rb)
|
|
67
|
-
#
|
|
68
|
-
# * URI::LDAP - (in uri/ldap.rb)
|
|
69
|
-
# * URI::LDAPS - (in uri/ldaps.rb)
|
|
70
|
-
#
|
|
71
|
-
# * URI::MailTo - (in uri/mailto.rb)
|
|
72
|
-
#
|
|
73
|
-
# * URI::Parser - (in uri/common.rb)
|
|
74
|
-
# * URI::REGEXP - (in uri/common.rb)
|
|
75
|
-
# * URI::REGEXP::PATTERN - (in uri/common.rb)
|
|
76
|
-
#
|
|
77
|
-
# * URI::Util - (in uri/common.rb)
|
|
78
|
-
# * URI::Escape - (in uri/common.rb)
|
|
79
|
-
# * URI::Error - (in uri/common.rb)
|
|
80
|
-
# * URI::InvalidURIError - (in uri/common.rb)
|
|
81
|
-
# * URI::InvalidComponentError - (in uri/common.rb)
|
|
82
|
-
# * URI::BadURIError - (in uri/common.rb)
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
# ## Copyright Info
|
|
87
|
-
#
|
|
88
|
-
# Author
|
|
89
|
-
# : Akira Yamada <akira@ruby-lang.org>
|
|
90
|
-
# Documentation
|
|
91
|
-
# : Akira Yamada <akira@ruby-lang.org> Dmitry V. Sabanin <sdmitry@lrn.ru>
|
|
92
|
-
# Vincent Batts <vbatts@hashbangbash.com>
|
|
93
|
-
# License
|
|
94
|
-
# : Copyright (c) 2001 akira yamada <akira@ruby-lang.org> You can redistribute
|
|
95
|
-
# it and/or modify it under the same term as Ruby.
|
|
96
|
-
# Revision
|
|
97
|
-
# : $Id$
|
|
98
|
-
#
|
|
99
|
-
#
|
|
1
|
+
%a{annotate:rdoc:skip}
|
|
100
2
|
module URI
|
|
101
|
-
#
|
|
3
|
+
# <!-- rdoc-file=lib/uri/http.rb -->
|
|
102
4
|
# The syntax of HTTP URIs is defined in RFC1738 section 3.3.
|
|
103
5
|
#
|
|
104
6
|
# Note that the Ruby URI library allows HTTP URLs containing usernames and
|
|
105
|
-
# passwords. This is not legal as per the RFC, but used to be
|
|
106
|
-
#
|
|
107
|
-
#
|
|
7
|
+
# passwords. This is not legal as per the RFC, but used to be supported in
|
|
8
|
+
# Internet Explorer 5 and 6, before the MS04-004 security update. See
|
|
9
|
+
# <URL:http://support.microsoft.com/kb/834489>.
|
|
108
10
|
#
|
|
109
11
|
class HTTP < Generic
|
|
12
|
+
# <!-- rdoc-file=lib/uri/http.rb -->
|
|
110
13
|
# A Default port of 80 for URI::HTTP.
|
|
14
|
+
#
|
|
111
15
|
DEFAULT_PORT: Integer
|
|
112
16
|
|
|
17
|
+
# <!-- rdoc-file=lib/uri/http.rb -->
|
|
113
18
|
# An Array of the available components for URI::HTTP.
|
|
19
|
+
#
|
|
114
20
|
COMPONENT: Array[Symbol]
|
|
115
21
|
|
|
116
|
-
#
|
|
117
|
-
#
|
|
22
|
+
# <!--
|
|
23
|
+
# rdoc-file=lib/uri/http.rb
|
|
24
|
+
# - build(args)
|
|
25
|
+
# -->
|
|
26
|
+
# ## Description
|
|
118
27
|
#
|
|
119
28
|
# Creates a new URI::HTTP object from components, with syntax checking.
|
|
120
29
|
#
|
|
121
|
-
# The components accepted are userinfo, host, port, path, query, and
|
|
122
|
-
# fragment.
|
|
30
|
+
# The components accepted are userinfo, host, port, path, query, and fragment.
|
|
123
31
|
#
|
|
124
|
-
# The components should be provided either as an Array, or as a Hash
|
|
125
|
-
#
|
|
32
|
+
# The components should be provided either as an Array, or as a Hash with keys
|
|
33
|
+
# formed by preceding the component names with a colon.
|
|
126
34
|
#
|
|
127
|
-
# If an Array is used, the components must be passed in the
|
|
128
|
-
#
|
|
35
|
+
# If an Array is used, the components must be passed in the order `[userinfo,
|
|
36
|
+
# host, port, path, query, fragment]`.
|
|
129
37
|
#
|
|
130
38
|
# Example:
|
|
131
39
|
#
|
|
@@ -134,14 +42,52 @@ module URI
|
|
|
134
42
|
# uri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
|
|
135
43
|
# "query", 'fragment'])
|
|
136
44
|
#
|
|
137
|
-
# Currently, if passed userinfo components this method generates
|
|
138
|
-
#
|
|
45
|
+
# Currently, if passed userinfo components this method generates invalid HTTP
|
|
46
|
+
# URIs as per RFC 1738.
|
|
139
47
|
#
|
|
140
48
|
def self.build: (Array[String | Integer] args) -> URI::HTTP
|
|
141
49
|
| ({ userinfo: String, host: String, port: Integer, path: String, query: String, fragment: String }) -> URI::HTTP
|
|
142
50
|
|
|
51
|
+
# <!--
|
|
52
|
+
# rdoc-file=lib/uri/http.rb
|
|
53
|
+
# - authority()
|
|
54
|
+
# -->
|
|
55
|
+
# ## Description
|
|
56
|
+
#
|
|
57
|
+
# Returns the authority for an HTTP uri, as defined in
|
|
58
|
+
# https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.
|
|
59
|
+
#
|
|
60
|
+
# Example:
|
|
61
|
+
#
|
|
62
|
+
# URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').authority #=> "www.example.com"
|
|
63
|
+
# URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').authority #=> "www.example.com:8000"
|
|
64
|
+
# URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').authority #=> "www.example.com"
|
|
143
65
|
#
|
|
144
|
-
|
|
66
|
+
def authority: () -> String
|
|
67
|
+
|
|
68
|
+
# <!--
|
|
69
|
+
# rdoc-file=lib/uri/http.rb
|
|
70
|
+
# - origin()
|
|
71
|
+
# -->
|
|
72
|
+
# ## Description
|
|
73
|
+
#
|
|
74
|
+
# Returns the origin for an HTTP uri, as defined in
|
|
75
|
+
# https://datatracker.ietf.org/doc/html/rfc6454.
|
|
76
|
+
#
|
|
77
|
+
# Example:
|
|
78
|
+
#
|
|
79
|
+
# URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').origin #=> "http://www.example.com"
|
|
80
|
+
# URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').origin #=> "http://www.example.com:8000"
|
|
81
|
+
# URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').origin #=> "http://www.example.com"
|
|
82
|
+
# URI::HTTPS.build(host: 'www.example.com', path: '/foo/bar').origin #=> "https://www.example.com"
|
|
83
|
+
#
|
|
84
|
+
def origin: () -> String
|
|
85
|
+
|
|
86
|
+
# <!--
|
|
87
|
+
# rdoc-file=lib/uri/http.rb
|
|
88
|
+
# - request_uri()
|
|
89
|
+
# -->
|
|
90
|
+
# ## Description
|
|
145
91
|
#
|
|
146
92
|
# Returns the full path for an HTTP request, as required by Net::HTTP::Get.
|
|
147
93
|
#
|
data/stdlib/uri/0/https.rbs
CHANGED
|
@@ -1,108 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
# ([RFC2396](http://tools.ietf.org/html/rfc2396)).
|
|
3
|
-
#
|
|
4
|
-
# ## Features
|
|
5
|
-
#
|
|
6
|
-
# * Uniform way of handling URIs.
|
|
7
|
-
# * Flexibility to introduce custom URI schemes.
|
|
8
|
-
# * Flexibility to have an alternate URI::Parser (or just different patterns
|
|
9
|
-
# and regexp's).
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# ## Basic example
|
|
13
|
-
#
|
|
14
|
-
# require 'uri'
|
|
15
|
-
#
|
|
16
|
-
# uri = URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
|
|
17
|
-
# #=> #<URI::HTTP http://foo.com/posts?id=30&limit=5#time=1305298413>
|
|
18
|
-
#
|
|
19
|
-
# uri.scheme #=> "http"
|
|
20
|
-
# uri.host #=> "foo.com"
|
|
21
|
-
# uri.path #=> "/posts"
|
|
22
|
-
# uri.query #=> "id=30&limit=5"
|
|
23
|
-
# uri.fragment #=> "time=1305298413"
|
|
24
|
-
#
|
|
25
|
-
# uri.to_s #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"
|
|
26
|
-
#
|
|
27
|
-
# ## Adding custom URIs
|
|
28
|
-
#
|
|
29
|
-
# module URI
|
|
30
|
-
# class RSYNC < Generic
|
|
31
|
-
# DEFAULT_PORT = 873
|
|
32
|
-
# end
|
|
33
|
-
# @@schemes['RSYNC'] = RSYNC
|
|
34
|
-
# end
|
|
35
|
-
# #=> URI::RSYNC
|
|
36
|
-
#
|
|
37
|
-
# URI.scheme_list
|
|
38
|
-
# #=> {"FILE"=>URI::File, "FTP"=>URI::FTP, "HTTP"=>URI::HTTP,
|
|
39
|
-
# # "HTTPS"=>URI::HTTPS, "LDAP"=>URI::LDAP, "LDAPS"=>URI::LDAPS,
|
|
40
|
-
# # "MAILTO"=>URI::MailTo, "RSYNC"=>URI::RSYNC}
|
|
41
|
-
#
|
|
42
|
-
# uri = URI("rsync://rsync.foo.com")
|
|
43
|
-
# #=> #<URI::RSYNC rsync://rsync.foo.com>
|
|
44
|
-
#
|
|
45
|
-
# ## RFC References
|
|
46
|
-
#
|
|
47
|
-
# A good place to view an RFC spec is http://www.ietf.org/rfc.html.
|
|
48
|
-
#
|
|
49
|
-
# Here is a list of all related RFC's:
|
|
50
|
-
# * [RFC822](http://tools.ietf.org/html/rfc822)
|
|
51
|
-
# * [RFC1738](http://tools.ietf.org/html/rfc1738)
|
|
52
|
-
# * [RFC2255](http://tools.ietf.org/html/rfc2255)
|
|
53
|
-
# * [RFC2368](http://tools.ietf.org/html/rfc2368)
|
|
54
|
-
# * [RFC2373](http://tools.ietf.org/html/rfc2373)
|
|
55
|
-
# * [RFC2396](http://tools.ietf.org/html/rfc2396)
|
|
56
|
-
# * [RFC2732](http://tools.ietf.org/html/rfc2732)
|
|
57
|
-
# * [RFC3986](http://tools.ietf.org/html/rfc3986)
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
# ## Class tree
|
|
61
|
-
#
|
|
62
|
-
# * URI::Generic (in uri/generic.rb)
|
|
63
|
-
# * URI::File - (in uri/file.rb)
|
|
64
|
-
# * URI::FTP - (in uri/ftp.rb)
|
|
65
|
-
# * URI::HTTP - (in uri/http.rb)
|
|
66
|
-
# * URI::HTTPS - (in uri/https.rb)
|
|
67
|
-
#
|
|
68
|
-
# * URI::LDAP - (in uri/ldap.rb)
|
|
69
|
-
# * URI::LDAPS - (in uri/ldaps.rb)
|
|
70
|
-
#
|
|
71
|
-
# * URI::MailTo - (in uri/mailto.rb)
|
|
72
|
-
#
|
|
73
|
-
# * URI::Parser - (in uri/common.rb)
|
|
74
|
-
# * URI::REGEXP - (in uri/common.rb)
|
|
75
|
-
# * URI::REGEXP::PATTERN - (in uri/common.rb)
|
|
76
|
-
#
|
|
77
|
-
# * URI::Util - (in uri/common.rb)
|
|
78
|
-
# * URI::Escape - (in uri/common.rb)
|
|
79
|
-
# * URI::Error - (in uri/common.rb)
|
|
80
|
-
# * URI::InvalidURIError - (in uri/common.rb)
|
|
81
|
-
# * URI::InvalidComponentError - (in uri/common.rb)
|
|
82
|
-
# * URI::BadURIError - (in uri/common.rb)
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
# ## Copyright Info
|
|
87
|
-
#
|
|
88
|
-
# Author
|
|
89
|
-
# : Akira Yamada <akira@ruby-lang.org>
|
|
90
|
-
# Documentation
|
|
91
|
-
# : Akira Yamada <akira@ruby-lang.org> Dmitry V. Sabanin <sdmitry@lrn.ru>
|
|
92
|
-
# Vincent Batts <vbatts@hashbangbash.com>
|
|
93
|
-
# License
|
|
94
|
-
# : Copyright (c) 2001 akira yamada <akira@ruby-lang.org> You can redistribute
|
|
95
|
-
# it and/or modify it under the same term as Ruby.
|
|
96
|
-
# Revision
|
|
97
|
-
# : $Id$
|
|
98
|
-
#
|
|
99
|
-
#
|
|
1
|
+
%a{annotate:rdoc:skip}
|
|
100
2
|
module URI
|
|
101
|
-
#
|
|
102
|
-
#
|
|
103
|
-
#
|
|
3
|
+
# <!-- rdoc-file=lib/uri/https.rb -->
|
|
4
|
+
# The default port for HTTPS URIs is 443, and the scheme is 'https:' rather than
|
|
5
|
+
# 'http:'. Other than that, HTTPS URIs are identical to HTTP URIs; see
|
|
6
|
+
# URI::HTTP.
|
|
7
|
+
#
|
|
104
8
|
class HTTPS < HTTP
|
|
9
|
+
# <!-- rdoc-file=lib/uri/https.rb -->
|
|
105
10
|
# A Default port of 443 for URI::HTTPS
|
|
11
|
+
#
|
|
106
12
|
DEFAULT_PORT: Integer
|
|
107
13
|
end
|
|
108
14
|
end
|
data/stdlib/uri/0/ldap.rbs
CHANGED
|
@@ -1,137 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
# ([RFC2396](http://tools.ietf.org/html/rfc2396)).
|
|
3
|
-
#
|
|
4
|
-
# ## Features
|
|
5
|
-
#
|
|
6
|
-
# * Uniform way of handling URIs.
|
|
7
|
-
# * Flexibility to introduce custom URI schemes.
|
|
8
|
-
# * Flexibility to have an alternate URI::Parser (or just different patterns
|
|
9
|
-
# and regexp's).
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# ## Basic example
|
|
13
|
-
#
|
|
14
|
-
# require 'uri'
|
|
15
|
-
#
|
|
16
|
-
# uri = URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
|
|
17
|
-
# #=> #<URI::HTTP http://foo.com/posts?id=30&limit=5#time=1305298413>
|
|
18
|
-
#
|
|
19
|
-
# uri.scheme #=> "http"
|
|
20
|
-
# uri.host #=> "foo.com"
|
|
21
|
-
# uri.path #=> "/posts"
|
|
22
|
-
# uri.query #=> "id=30&limit=5"
|
|
23
|
-
# uri.fragment #=> "time=1305298413"
|
|
24
|
-
#
|
|
25
|
-
# uri.to_s #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"
|
|
26
|
-
#
|
|
27
|
-
# ## Adding custom URIs
|
|
28
|
-
#
|
|
29
|
-
# module URI
|
|
30
|
-
# class RSYNC < Generic
|
|
31
|
-
# DEFAULT_PORT = 873
|
|
32
|
-
# end
|
|
33
|
-
# @@schemes['RSYNC'] = RSYNC
|
|
34
|
-
# end
|
|
35
|
-
# #=> URI::RSYNC
|
|
36
|
-
#
|
|
37
|
-
# URI.scheme_list
|
|
38
|
-
# #=> {"FILE"=>URI::File, "FTP"=>URI::FTP, "HTTP"=>URI::HTTP,
|
|
39
|
-
# # "HTTPS"=>URI::HTTPS, "LDAP"=>URI::LDAP, "LDAPS"=>URI::LDAPS,
|
|
40
|
-
# # "MAILTO"=>URI::MailTo, "RSYNC"=>URI::RSYNC}
|
|
41
|
-
#
|
|
42
|
-
# uri = URI("rsync://rsync.foo.com")
|
|
43
|
-
# #=> #<URI::RSYNC rsync://rsync.foo.com>
|
|
44
|
-
#
|
|
45
|
-
# ## RFC References
|
|
46
|
-
#
|
|
47
|
-
# A good place to view an RFC spec is http://www.ietf.org/rfc.html.
|
|
48
|
-
#
|
|
49
|
-
# Here is a list of all related RFC's:
|
|
50
|
-
# * [RFC822](http://tools.ietf.org/html/rfc822)
|
|
51
|
-
# * [RFC1738](http://tools.ietf.org/html/rfc1738)
|
|
52
|
-
# * [RFC2255](http://tools.ietf.org/html/rfc2255)
|
|
53
|
-
# * [RFC2368](http://tools.ietf.org/html/rfc2368)
|
|
54
|
-
# * [RFC2373](http://tools.ietf.org/html/rfc2373)
|
|
55
|
-
# * [RFC2396](http://tools.ietf.org/html/rfc2396)
|
|
56
|
-
# * [RFC2732](http://tools.ietf.org/html/rfc2732)
|
|
57
|
-
# * [RFC3986](http://tools.ietf.org/html/rfc3986)
|
|
58
|
-
#
|
|
59
|
-
#
|
|
60
|
-
# ## Class tree
|
|
61
|
-
#
|
|
62
|
-
# * URI::Generic (in uri/generic.rb)
|
|
63
|
-
# * URI::File - (in uri/file.rb)
|
|
64
|
-
# * URI::FTP - (in uri/ftp.rb)
|
|
65
|
-
# * URI::HTTP - (in uri/http.rb)
|
|
66
|
-
# * URI::HTTPS - (in uri/https.rb)
|
|
67
|
-
#
|
|
68
|
-
# * URI::LDAP - (in uri/ldap.rb)
|
|
69
|
-
# * URI::LDAPS - (in uri/ldaps.rb)
|
|
70
|
-
#
|
|
71
|
-
# * URI::MailTo - (in uri/mailto.rb)
|
|
72
|
-
#
|
|
73
|
-
# * URI::Parser - (in uri/common.rb)
|
|
74
|
-
# * URI::REGEXP - (in uri/common.rb)
|
|
75
|
-
# * URI::REGEXP::PATTERN - (in uri/common.rb)
|
|
76
|
-
#
|
|
77
|
-
# * URI::Util - (in uri/common.rb)
|
|
78
|
-
# * URI::Escape - (in uri/common.rb)
|
|
79
|
-
# * URI::Error - (in uri/common.rb)
|
|
80
|
-
# * URI::InvalidURIError - (in uri/common.rb)
|
|
81
|
-
# * URI::InvalidComponentError - (in uri/common.rb)
|
|
82
|
-
# * URI::BadURIError - (in uri/common.rb)
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
# ## Copyright Info
|
|
87
|
-
#
|
|
88
|
-
# Author
|
|
89
|
-
# : Akira Yamada <akira@ruby-lang.org>
|
|
90
|
-
# Documentation
|
|
91
|
-
# : Akira Yamada <akira@ruby-lang.org> Dmitry V. Sabanin <sdmitry@lrn.ru>
|
|
92
|
-
# Vincent Batts <vbatts@hashbangbash.com>
|
|
93
|
-
# License
|
|
94
|
-
# : Copyright (c) 2001 akira yamada <akira@ruby-lang.org> You can redistribute
|
|
95
|
-
# it and/or modify it under the same term as Ruby.
|
|
96
|
-
# Revision
|
|
97
|
-
# : $Id$
|
|
98
|
-
#
|
|
99
|
-
#
|
|
1
|
+
%a{annotate:rdoc:skip}
|
|
100
2
|
module URI
|
|
101
|
-
#
|
|
3
|
+
# <!-- rdoc-file=lib/uri/ldap.rb -->
|
|
102
4
|
# LDAP URI SCHEMA (described in RFC2255).
|
|
103
|
-
#
|
|
104
|
-
# ldap://<host>/<dn>[?<attrs>[?<scope>[?<filter>[?<extensions>]]]]
|
|
105
|
-
# +
|
|
5
|
+
#
|
|
106
6
|
class LDAP < Generic
|
|
7
|
+
# <!-- rdoc-file=lib/uri/ldap.rb -->
|
|
107
8
|
# A Default port of 389 for URI::LDAP.
|
|
9
|
+
#
|
|
108
10
|
DEFAULT_PORT: Integer
|
|
109
11
|
|
|
12
|
+
# <!-- rdoc-file=lib/uri/ldap.rb -->
|
|
110
13
|
# An Array of the available components for URI::LDAP.
|
|
14
|
+
#
|
|
111
15
|
COMPONENT: Array[Symbol]
|
|
112
16
|
|
|
17
|
+
# <!-- rdoc-file=lib/uri/ldap.rb -->
|
|
113
18
|
# Scopes available for the starting point.
|
|
114
19
|
#
|
|
115
|
-
# *
|
|
116
|
-
# *
|
|
117
|
-
#
|
|
118
|
-
# *
|
|
20
|
+
# * SCOPE_BASE - the Base DN
|
|
21
|
+
# * SCOPE_ONE - one level under the Base DN, not including the base DN and
|
|
22
|
+
# not including any entries under this
|
|
23
|
+
# * SCOPE_SUB - subtrees, all entries at all levels
|
|
119
24
|
#
|
|
120
25
|
SCOPE: Array[String]
|
|
121
26
|
|
|
122
|
-
#
|
|
123
|
-
#
|
|
27
|
+
# <!--
|
|
28
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
29
|
+
# - build(args)
|
|
30
|
+
# -->
|
|
31
|
+
# ## Description
|
|
124
32
|
#
|
|
125
33
|
# Creates a new URI::LDAP object from components, with syntax checking.
|
|
126
34
|
#
|
|
127
|
-
# The components accepted are host, port, dn, attributes,
|
|
128
|
-
#
|
|
35
|
+
# The components accepted are host, port, dn, attributes, scope, filter, and
|
|
36
|
+
# extensions.
|
|
129
37
|
#
|
|
130
|
-
# The components should be provided either as an Array, or as a Hash
|
|
131
|
-
#
|
|
38
|
+
# The components should be provided either as an Array, or as a Hash with keys
|
|
39
|
+
# formed by preceding the component names with a colon.
|
|
132
40
|
#
|
|
133
|
-
# If an Array is used, the components must be passed in the
|
|
134
|
-
#
|
|
41
|
+
# If an Array is used, the components must be passed in the order `[host, port,
|
|
42
|
+
# dn, attributes, scope, filter, extensions]`.
|
|
135
43
|
#
|
|
136
44
|
# Example:
|
|
137
45
|
#
|
|
@@ -144,14 +52,17 @@ module URI
|
|
|
144
52
|
def self.build: (Array[nil | String | Integer] args) -> URI::LDAP
|
|
145
53
|
| ({ host: String, port: Integer?, dn: String, attributes: String?, scope: String?, filter: String?, extensions: String? }) -> URI::LDAP
|
|
146
54
|
|
|
55
|
+
# <!--
|
|
56
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
57
|
+
# - new(*arg)
|
|
58
|
+
# -->
|
|
59
|
+
# ## Description
|
|
147
60
|
#
|
|
148
|
-
#
|
|
149
|
-
#
|
|
150
|
-
# Creates a new URI::LDAP object from generic URI components as per
|
|
151
|
-
# RFC 2396. No LDAP-specific syntax checking is performed.
|
|
61
|
+
# Creates a new URI::LDAP object from generic URI components as per RFC 2396. No
|
|
62
|
+
# LDAP-specific syntax checking is performed.
|
|
152
63
|
#
|
|
153
|
-
# Arguments are
|
|
154
|
-
#
|
|
64
|
+
# Arguments are `scheme`, `userinfo`, `host`, `port`, `registry`, `path`,
|
|
65
|
+
# `opaque`, `query`, and `fragment`, in that order.
|
|
155
66
|
#
|
|
156
67
|
# Example:
|
|
157
68
|
#
|
|
@@ -162,63 +73,158 @@ module URI
|
|
|
162
73
|
#
|
|
163
74
|
def initialize: (String schema, String? userinfo, String host, Integer? port, String? registry, String? path, String? opaque, String query, String? fragment) -> URI::LDAP
|
|
164
75
|
|
|
165
|
-
#
|
|
76
|
+
# <!--
|
|
77
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
78
|
+
# - parse_dn()
|
|
79
|
+
# -->
|
|
80
|
+
# Private method to cleanup `dn` from using the `path` component attribute.
|
|
81
|
+
#
|
|
166
82
|
def parse_dn: () -> nil
|
|
167
83
|
|
|
168
|
-
#
|
|
169
|
-
#
|
|
84
|
+
# <!--
|
|
85
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
86
|
+
# - parse_query()
|
|
87
|
+
# -->
|
|
88
|
+
# Private method to cleanup `attributes`, `scope`, `filter`, and `extensions`
|
|
89
|
+
# from using the `query` component attribute.
|
|
90
|
+
#
|
|
170
91
|
def parse_query: () -> nil
|
|
171
92
|
|
|
172
|
-
#
|
|
93
|
+
# <!--
|
|
94
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
95
|
+
# - build_path_query()
|
|
96
|
+
# -->
|
|
97
|
+
# Private method to assemble `query` from `attributes`, `scope`, `filter`, and
|
|
98
|
+
# `extensions`.
|
|
99
|
+
#
|
|
173
100
|
def build_path_query: () -> String
|
|
174
101
|
|
|
102
|
+
# <!--
|
|
103
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
104
|
+
# - dn()
|
|
105
|
+
# -->
|
|
175
106
|
# Returns dn.
|
|
107
|
+
#
|
|
176
108
|
def dn: () -> String
|
|
177
109
|
|
|
178
|
-
#
|
|
110
|
+
# <!--
|
|
111
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
112
|
+
# - set_dn(val)
|
|
113
|
+
# -->
|
|
114
|
+
# Private setter for dn `val`.
|
|
115
|
+
#
|
|
179
116
|
def set_dn: (String val) -> String
|
|
180
117
|
|
|
181
|
-
#
|
|
118
|
+
# <!--
|
|
119
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
120
|
+
# - dn=(val)
|
|
121
|
+
# -->
|
|
122
|
+
# Setter for dn `val`.
|
|
123
|
+
#
|
|
182
124
|
def dn=: (String val) -> String
|
|
183
125
|
|
|
126
|
+
# <!--
|
|
127
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
128
|
+
# - attributes()
|
|
129
|
+
# -->
|
|
184
130
|
# Returns attributes.
|
|
131
|
+
#
|
|
185
132
|
def attributes: () -> String
|
|
186
133
|
|
|
187
|
-
#
|
|
134
|
+
# <!--
|
|
135
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
136
|
+
# - set_attributes(val)
|
|
137
|
+
# -->
|
|
138
|
+
# Private setter for attributes `val`.
|
|
139
|
+
#
|
|
188
140
|
def set_attributes: (String val) -> String
|
|
189
141
|
|
|
190
|
-
#
|
|
142
|
+
# <!--
|
|
143
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
144
|
+
# - attributes=(val)
|
|
145
|
+
# -->
|
|
146
|
+
# Setter for attributes `val`.
|
|
147
|
+
#
|
|
191
148
|
def attributes=: (String val) -> String
|
|
192
149
|
|
|
150
|
+
# <!--
|
|
151
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
152
|
+
# - scope()
|
|
153
|
+
# -->
|
|
193
154
|
# Returns scope.
|
|
155
|
+
#
|
|
194
156
|
def scope: () -> String
|
|
195
157
|
|
|
196
|
-
#
|
|
158
|
+
# <!--
|
|
159
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
160
|
+
# - set_scope(val)
|
|
161
|
+
# -->
|
|
162
|
+
# Private setter for scope `val`.
|
|
163
|
+
#
|
|
197
164
|
def set_scope: (String val) -> String
|
|
198
165
|
|
|
199
|
-
#
|
|
166
|
+
# <!--
|
|
167
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
168
|
+
# - scope=(val)
|
|
169
|
+
# -->
|
|
170
|
+
# Setter for scope `val`.
|
|
171
|
+
#
|
|
200
172
|
def scope=: (String val) -> String
|
|
201
173
|
|
|
174
|
+
# <!--
|
|
175
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
176
|
+
# - filter()
|
|
177
|
+
# -->
|
|
202
178
|
# Returns filter.
|
|
179
|
+
#
|
|
203
180
|
def filter: () -> String
|
|
204
181
|
|
|
205
|
-
#
|
|
182
|
+
# <!--
|
|
183
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
184
|
+
# - set_filter(val)
|
|
185
|
+
# -->
|
|
186
|
+
# Private setter for filter `val`.
|
|
187
|
+
#
|
|
206
188
|
def set_filter: (String val) -> String
|
|
207
189
|
|
|
208
|
-
#
|
|
190
|
+
# <!--
|
|
191
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
192
|
+
# - filter=(val)
|
|
193
|
+
# -->
|
|
194
|
+
# Setter for filter `val`.
|
|
195
|
+
#
|
|
209
196
|
def filter=: (String val) -> String
|
|
210
197
|
|
|
198
|
+
# <!--
|
|
199
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
200
|
+
# - extensions()
|
|
201
|
+
# -->
|
|
211
202
|
# Returns extensions.
|
|
203
|
+
#
|
|
212
204
|
def extensions: () -> untyped
|
|
213
205
|
|
|
214
|
-
#
|
|
206
|
+
# <!--
|
|
207
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
208
|
+
# - set_extensions(val)
|
|
209
|
+
# -->
|
|
210
|
+
# Private setter for extensions `val`.
|
|
211
|
+
#
|
|
215
212
|
def set_extensions: (String val) -> String
|
|
216
213
|
|
|
217
|
-
#
|
|
214
|
+
# <!--
|
|
215
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
216
|
+
# - extensions=(val)
|
|
217
|
+
# -->
|
|
218
|
+
# Setter for extensions `val`.
|
|
219
|
+
#
|
|
218
220
|
def extensions=: (String val) -> String
|
|
219
221
|
|
|
220
|
-
#
|
|
221
|
-
#
|
|
222
|
+
# <!--
|
|
223
|
+
# rdoc-file=lib/uri/ldap.rb
|
|
224
|
+
# - hierarchical?()
|
|
225
|
+
# -->
|
|
226
|
+
# Checks if URI has a path. For URI::LDAP this will return `false`.
|
|
227
|
+
#
|
|
222
228
|
def hierarchical?: () -> ::FalseClass
|
|
223
229
|
end
|
|
224
230
|
end
|