rbs 0.10.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +9 -9
- data/CHANGELOG.md +29 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/Rakefile +16 -6
- data/Steepfile +28 -0
- data/bin/steep +4 -0
- data/bin/test_runner.rb +7 -5
- data/docs/syntax.md +14 -1
- data/lib/rbs/ast/comment.rb +7 -1
- data/lib/rbs/ast/declarations.rb +15 -9
- data/lib/rbs/ast/members.rb +3 -8
- data/lib/rbs/buffer.rb +1 -1
- data/lib/rbs/cli.rb +72 -3
- data/lib/rbs/constant.rb +1 -1
- data/lib/rbs/constant_table.rb +9 -8
- data/lib/rbs/definition.rb +31 -14
- data/lib/rbs/definition_builder.rb +97 -67
- data/lib/rbs/environment.rb +28 -11
- data/lib/rbs/environment_loader.rb +67 -47
- data/lib/rbs/location.rb +1 -5
- data/lib/rbs/method_type.rb +5 -5
- data/lib/rbs/namespace.rb +14 -3
- data/lib/rbs/parser.y +2 -12
- data/lib/rbs/prototype/rb.rb +3 -5
- data/lib/rbs/prototype/rbi.rb +1 -4
- data/lib/rbs/prototype/runtime.rb +0 -4
- data/lib/rbs/substitution.rb +4 -3
- data/lib/rbs/test/setup.rb +5 -1
- data/lib/rbs/test/setup_helper.rb +15 -0
- data/lib/rbs/test/tester.rb +7 -5
- data/lib/rbs/test/type_check.rb +14 -2
- data/lib/rbs/type_name.rb +18 -1
- data/lib/rbs/type_name_resolver.rb +10 -3
- data/lib/rbs/types.rb +27 -21
- data/lib/rbs/variance_calculator.rb +9 -6
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +26 -17
- data/sig/annotation.rbs +26 -0
- data/sig/buffer.rbs +28 -0
- data/sig/builtin_names.rbs +41 -0
- data/sig/comment.rbs +26 -0
- data/sig/constant.rbs +21 -0
- data/sig/constant_table.rbs +30 -0
- data/sig/declarations.rbs +202 -0
- data/sig/definition.rbs +129 -0
- data/sig/definition_builder.rbs +94 -0
- data/sig/environment.rbs +94 -0
- data/sig/environment_loader.rbs +58 -0
- data/sig/location.rbs +52 -0
- data/sig/members.rbs +160 -0
- data/sig/method_types.rbs +40 -0
- data/sig/namespace.rbs +124 -0
- data/sig/polyfill.rbs +3 -0
- data/sig/rbs.rbs +3 -0
- data/sig/substitution.rbs +39 -0
- data/sig/type_name_resolver.rbs +24 -0
- data/sig/typename.rbs +70 -0
- data/sig/types.rbs +361 -0
- data/sig/util.rbs +13 -0
- data/sig/variance_calculator.rbs +35 -0
- data/sig/version.rbs +3 -0
- data/sig/writer.rbs +40 -0
- data/stdlib/bigdecimal/big_decimal.rbs +887 -0
- data/stdlib/bigdecimal/math/big_math.rbs +142 -0
- data/stdlib/builtin/array.rbs +2 -1
- data/stdlib/builtin/builtin.rbs +0 -3
- data/stdlib/builtin/hash.rbs +1 -1
- data/stdlib/builtin/kernel.rbs +2 -0
- data/stdlib/builtin/math.rbs +26 -26
- data/stdlib/builtin/struct.rbs +9 -10
- data/stdlib/date/date.rbs +1056 -0
- data/stdlib/date/date_time.rbs +582 -0
- data/stdlib/forwardable/forwardable.rbs +204 -0
- data/stdlib/pathname/pathname.rbs +2 -0
- data/stdlib/pty/pty.rbs +5 -29
- data/stdlib/set/set.rbs +1 -1
- data/stdlib/uri/file.rbs +167 -0
- data/stdlib/uri/generic.rbs +875 -0
- data/stdlib/uri/http.rbs +158 -0
- data/stdlib/uri/https.rbs +108 -0
- data/stdlib/uri/ldap.rbs +224 -0
- data/stdlib/uri/ldaps.rbs +108 -0
- data/stdlib/zlib/zlib.rbs +1 -1
- data/steep/Gemfile +3 -0
- data/steep/Gemfile.lock +51 -0
- metadata +45 -5
data/stdlib/uri/http.rbs
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
# URI is a module providing classes to handle Uniform Resource Identifiers
|
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
|
+
#
|
100
|
+
module URI
|
101
|
+
#
|
102
|
+
# The syntax of HTTP URIs is defined in RFC1738 section 3.3.
|
103
|
+
#
|
104
|
+
# 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
|
+
# supported in Internet Explorer 5 and 6, before the MS04-004 security
|
107
|
+
# update. See <URL:http://support.microsoft.com/kb/834489>.
|
108
|
+
#
|
109
|
+
class HTTP < Generic
|
110
|
+
# A Default port of 80 for URI::HTTP.
|
111
|
+
DEFAULT_PORT: Integer
|
112
|
+
|
113
|
+
# An Array of the available components for URI::HTTP.
|
114
|
+
COMPONENT: Array[Symbol]
|
115
|
+
|
116
|
+
#
|
117
|
+
# == Description
|
118
|
+
#
|
119
|
+
# Creates a new URI::HTTP object from components, with syntax checking.
|
120
|
+
#
|
121
|
+
# The components accepted are userinfo, host, port, path, query, and
|
122
|
+
# fragment.
|
123
|
+
#
|
124
|
+
# The components should be provided either as an Array, or as a Hash
|
125
|
+
# with keys formed by preceding the component names with a colon.
|
126
|
+
#
|
127
|
+
# If an Array is used, the components must be passed in the
|
128
|
+
# order <code>[userinfo, host, port, path, query, fragment]</code>.
|
129
|
+
#
|
130
|
+
# Example:
|
131
|
+
#
|
132
|
+
# uri = URI::HTTP.build(host: 'www.example.com', path: '/foo/bar')
|
133
|
+
#
|
134
|
+
# uri = URI::HTTP.build([nil, "www.example.com", nil, "/path",
|
135
|
+
# "query", 'fragment'])
|
136
|
+
#
|
137
|
+
# Currently, if passed userinfo components this method generates
|
138
|
+
# invalid HTTP URIs as per RFC 1738.
|
139
|
+
#
|
140
|
+
def self.build: (Array[String | Integer] args) -> URI::HTTP
|
141
|
+
| ({ userinfo: String, host: String, port: Integer, path: String, query: String, fragment: String }) -> URI::HTTP
|
142
|
+
|
143
|
+
#
|
144
|
+
# == Description
|
145
|
+
#
|
146
|
+
# Returns the full path for an HTTP request, as required by Net::HTTP::Get.
|
147
|
+
#
|
148
|
+
# If the URI contains a query, the full path is URI#path + '?' + URI#query.
|
149
|
+
# Otherwise, the path is simply URI#path.
|
150
|
+
#
|
151
|
+
# Example:
|
152
|
+
#
|
153
|
+
# uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true')
|
154
|
+
# uri.request_uri # => "/foo/bar?test=true"
|
155
|
+
#
|
156
|
+
def request_uri: () -> String
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# URI is a module providing classes to handle Uniform Resource Identifiers
|
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
|
+
#
|
100
|
+
module URI
|
101
|
+
# The default port for HTTPS URIs is 443, and the scheme is 'https:' rather
|
102
|
+
# than 'http:'. Other than that, HTTPS URIs are identical to HTTP URIs;
|
103
|
+
# see URI::HTTP.
|
104
|
+
class HTTPS < HTTP
|
105
|
+
# A Default port of 443 for URI::HTTPS
|
106
|
+
DEFAULT_PORT: Integer
|
107
|
+
end
|
108
|
+
end
|
data/stdlib/uri/ldap.rbs
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
# URI is a module providing classes to handle Uniform Resource Identifiers
|
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
|
+
#
|
100
|
+
module URI
|
101
|
+
#
|
102
|
+
# LDAP URI SCHEMA (described in RFC2255).
|
103
|
+
# -
|
104
|
+
# ldap://<host>/<dn>[?<attrs>[?<scope>[?<filter>[?<extensions>]]]]
|
105
|
+
# +
|
106
|
+
class LDAP < Generic
|
107
|
+
# A Default port of 389 for URI::LDAP.
|
108
|
+
DEFAULT_PORT: Integer
|
109
|
+
|
110
|
+
# An Array of the available components for URI::LDAP.
|
111
|
+
COMPONENT: Array[Symbol]
|
112
|
+
|
113
|
+
# Scopes available for the starting point.
|
114
|
+
#
|
115
|
+
# * SCOPE_BASE - the Base DN
|
116
|
+
# * SCOPE_ONE - one level under the Base DN, not including the base DN and
|
117
|
+
# not including any entries under this
|
118
|
+
# * SCOPE_SUB - subtrees, all entries at all levels
|
119
|
+
#
|
120
|
+
SCOPE: Array[String]
|
121
|
+
|
122
|
+
#
|
123
|
+
# == Description
|
124
|
+
#
|
125
|
+
# Creates a new URI::LDAP object from components, with syntax checking.
|
126
|
+
#
|
127
|
+
# The components accepted are host, port, dn, attributes,
|
128
|
+
# scope, filter, and extensions.
|
129
|
+
#
|
130
|
+
# The components should be provided either as an Array, or as a Hash
|
131
|
+
# with keys formed by preceding the component names with a colon.
|
132
|
+
#
|
133
|
+
# If an Array is used, the components must be passed in the
|
134
|
+
# order <code>[host, port, dn, attributes, scope, filter, extensions]</code>.
|
135
|
+
#
|
136
|
+
# Example:
|
137
|
+
#
|
138
|
+
# uri = URI::LDAP.build({:host => 'ldap.example.com',
|
139
|
+
# :dn => '/dc=example'})
|
140
|
+
#
|
141
|
+
# uri = URI::LDAP.build(["ldap.example.com", nil,
|
142
|
+
# "/dc=example;dc=com", "query", nil, nil, nil])
|
143
|
+
#
|
144
|
+
def self.build: (Array[nil | String | Integer] args) -> URI::LDAP
|
145
|
+
| ({ host: String, port: Integer?, dn: String, attributes: String?, scope: String?, filter: String?, extensions: String? }) -> URI::LDAP
|
146
|
+
|
147
|
+
#
|
148
|
+
# == Description
|
149
|
+
#
|
150
|
+
# Creates a new URI::LDAP object from generic URI components as per
|
151
|
+
# RFC 2396. No LDAP-specific syntax checking is performed.
|
152
|
+
#
|
153
|
+
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
|
154
|
+
# +opaque+, +query+, and +fragment+, in that order.
|
155
|
+
#
|
156
|
+
# Example:
|
157
|
+
#
|
158
|
+
# uri = URI::LDAP.new("ldap", nil, "ldap.example.com", nil, nil,
|
159
|
+
# "/dc=example;dc=com", nil, "query", nil)
|
160
|
+
#
|
161
|
+
# See also URI::Generic.new.
|
162
|
+
#
|
163
|
+
def initialize: (String schema, String? userinfo, String host, Integer? port, String? registry, String? path, String? opaque, String query, String? fragment) -> URI::LDAP
|
164
|
+
|
165
|
+
# Private method to cleanup +dn+ from using the +path+ component attribute.
|
166
|
+
def parse_dn: () -> nil
|
167
|
+
|
168
|
+
# Private method to cleanup +attributes+, +scope+, +filter+, and +extensions+
|
169
|
+
# from using the +query+ component attribute.
|
170
|
+
def parse_query: () -> nil
|
171
|
+
|
172
|
+
# Private method to assemble +query+ from +attributes+, +scope+, +filter+, and +extensions+.
|
173
|
+
def build_path_query: () -> String
|
174
|
+
|
175
|
+
# Returns dn.
|
176
|
+
def dn: () -> String
|
177
|
+
|
178
|
+
# Private setter for dn +val+.
|
179
|
+
def set_dn: (String val) -> String
|
180
|
+
|
181
|
+
# Setter for dn +val+.
|
182
|
+
def dn=: (String val) -> String
|
183
|
+
|
184
|
+
# Returns attributes.
|
185
|
+
def attributes: () -> String
|
186
|
+
|
187
|
+
# Private setter for attributes +val+.
|
188
|
+
def set_attributes: (String val) -> String
|
189
|
+
|
190
|
+
# Setter for attributes +val+.
|
191
|
+
def attributes=: (String val) -> String
|
192
|
+
|
193
|
+
# Returns scope.
|
194
|
+
def scope: () -> String
|
195
|
+
|
196
|
+
# Private setter for scope +val+.
|
197
|
+
def set_scope: (String val) -> String
|
198
|
+
|
199
|
+
# Setter for scope +val+.
|
200
|
+
def scope=: (String val) -> String
|
201
|
+
|
202
|
+
# Returns filter.
|
203
|
+
def filter: () -> String
|
204
|
+
|
205
|
+
# Private setter for filter +val+.
|
206
|
+
def set_filter: (String val) -> String
|
207
|
+
|
208
|
+
# Setter for filter +val+.
|
209
|
+
def filter=: (String val) -> String
|
210
|
+
|
211
|
+
# Returns extensions.
|
212
|
+
def extensions: () -> untyped
|
213
|
+
|
214
|
+
# Private setter for extensions +val+.
|
215
|
+
def set_extensions: (String val) -> String
|
216
|
+
|
217
|
+
# Setter for extensions +val+.
|
218
|
+
def extensions=: (String val) -> String
|
219
|
+
|
220
|
+
# Checks if URI has a path.
|
221
|
+
# For URI::LDAP this will return +false+.
|
222
|
+
def hierarchical?: () -> ::FalseClass
|
223
|
+
end
|
224
|
+
end
|