rbs 0.12.1 → 0.15.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 +1 -1
- data/.gitignore +0 -1
- data/CHANGELOG.md +31 -0
- data/Gemfile +3 -0
- data/README.md +8 -2
- data/Rakefile +2 -2
- data/Steepfile +1 -0
- data/bin/annotate-with-rdoc +1 -1
- data/bin/setup +0 -2
- data/docs/CONTRIBUTING.md +1 -0
- data/docs/syntax.md +50 -6
- data/goodcheck.yml +22 -5
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/cli.rb +12 -4
- data/lib/rbs/constant.rb +1 -1
- data/lib/rbs/constant_table.rb +9 -8
- data/lib/rbs/definition_builder.rb +6 -7
- data/lib/rbs/environment.rb +5 -1
- data/lib/rbs/environment_loader.rb +12 -12
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/parser.rb +3148 -0
- data/lib/rbs/parser.y +10 -3
- data/lib/rbs/prototype/rb.rb +38 -6
- data/lib/rbs/prototype/runtime.rb +17 -7
- data/lib/rbs/test/hook.rb +2 -0
- data/lib/rbs/test/setup_helper.rb +4 -4
- data/lib/rbs/test/tester.rb +4 -1
- data/lib/rbs/test/type_check.rb +12 -6
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/variance_calculator.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +25 -15
- data/sig/constant.rbs +21 -0
- data/sig/constant_table.rbs +30 -0
- data/sig/declarations.rbs +2 -2
- data/sig/definition.rbs +2 -2
- data/sig/definition_builder.rbs +4 -5
- data/sig/environment_loader.rbs +54 -0
- data/sig/members.rbs +2 -2
- data/sig/method_types.rbs +1 -1
- data/sig/namespace.rbs +4 -4
- data/sig/parser.rbs +25 -0
- data/sig/substitution.rbs +3 -3
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +1 -1
- data/sig/version.rbs +3 -0
- data/sig/writer.rbs +40 -0
- data/stdlib/base64/base64.rbs +1 -1
- data/stdlib/benchmark/benchmark.rbs +2 -2
- data/stdlib/builtin/array.rbs +124 -120
- data/stdlib/builtin/basic_object.rbs +54 -54
- data/stdlib/builtin/binding.rbs +42 -42
- data/stdlib/builtin/builtin.rbs +28 -0
- data/stdlib/builtin/class.rbs +33 -33
- data/stdlib/builtin/complex.rbs +90 -90
- data/stdlib/builtin/encoding.rbs +33 -33
- data/stdlib/builtin/enumerable.rbs +58 -52
- data/stdlib/builtin/enumerator.rbs +35 -35
- data/stdlib/builtin/errors.rbs +2 -2
- data/stdlib/builtin/exception.rbs +50 -50
- data/stdlib/builtin/false_class.rbs +6 -6
- data/stdlib/builtin/fiber.rbs +14 -14
- data/stdlib/builtin/fiber_error.rbs +1 -1
- data/stdlib/builtin/float.rbs +161 -161
- data/stdlib/builtin/gc.rbs +3 -3
- data/stdlib/builtin/hash.rbs +7 -7
- data/stdlib/builtin/io.rbs +88 -88
- data/stdlib/builtin/kernel.rbs +71 -153
- data/stdlib/builtin/match_data.rbs +1 -1
- data/stdlib/builtin/method.rbs +19 -19
- data/stdlib/builtin/module.rbs +13 -13
- data/stdlib/builtin/nil_class.rbs +20 -20
- data/stdlib/builtin/numeric.rbs +101 -101
- data/stdlib/builtin/object.rbs +173 -173
- data/stdlib/builtin/proc.rbs +91 -91
- data/stdlib/builtin/random.rbs +1 -1
- data/stdlib/builtin/range.rbs +3 -5
- data/stdlib/builtin/rational.rbs +83 -83
- data/stdlib/builtin/signal.rbs +7 -7
- data/stdlib/builtin/string.rbs +10 -10
- data/stdlib/builtin/string_io.rbs +8 -8
- data/stdlib/builtin/struct.rbs +1 -1
- data/stdlib/builtin/symbol.rbs +1 -1
- data/stdlib/builtin/thread.rbs +189 -189
- data/stdlib/builtin/thread_group.rbs +2 -2
- data/stdlib/builtin/true_class.rbs +10 -10
- data/stdlib/builtin/warning.rbs +1 -1
- data/stdlib/coverage/coverage.rbs +2 -2
- data/stdlib/csv/csv.rbs +1 -1
- data/stdlib/date/date.rbs +4 -4
- data/stdlib/date/date_time.rbs +1 -1
- data/stdlib/find/find.rbs +12 -12
- data/stdlib/logger/log_device.rbs +1 -1
- data/stdlib/logger/logger.rbs +1 -1
- data/stdlib/pathname/pathname.rbs +41 -39
- data/stdlib/pstore/pstore.rbs +287 -0
- data/stdlib/pty/pty.rbs +5 -29
- data/stdlib/tmpdir/tmpdir.rbs +12 -12
- data/stdlib/uri/generic.rbs +2 -2
- 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/steep/Gemfile.lock +13 -17
- metadata +13 -3
data/stdlib/pty/pty.rbs
CHANGED
@@ -65,34 +65,10 @@ module PTY
|
|
65
65
|
# `raise`
|
66
66
|
# : If `true` and the process identified by `pid` is no longer alive a
|
67
67
|
# PTY::ChildExited is raised.
|
68
|
-
def self.check: (Integer pid) -> (Process::Status | nil)
|
69
|
-
| (Integer pid, FalseClass raise) -> (Process::Status | nil)
|
70
|
-
| (Integer pid, TrueClass raise) -> nil
|
71
|
-
|
72
|
-
# Spawns the specified command on a newly allocated pty. You can also use the
|
73
|
-
# alias ::getpty.
|
74
|
-
#
|
75
|
-
# The command's controlling tty is set to the slave device of the pty and its
|
76
|
-
# standard input/output/error is redirected to the slave device.
|
77
68
|
#
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
# ### Return values
|
82
|
-
#
|
83
|
-
# In the non-block form this returns an array of size three, `[r, w, pid]`.
|
84
|
-
#
|
85
|
-
# In the block form these same values will be yielded to the block:
|
86
|
-
#
|
87
|
-
# `r`
|
88
|
-
# : A readable IO that contains the command's standard output and standard
|
89
|
-
# error
|
90
|
-
# `w`
|
91
|
-
# : A writable IO that is the command's standard input
|
92
|
-
# `pid`
|
93
|
-
# : The process identifier for the command.
|
94
|
-
def self.getpty: (*String command) -> [ IO, IO, Integer ]
|
95
|
-
| (*String command) { ([ IO ,IO , Integer ]) -> untyped } -> untyped
|
69
|
+
def self.check: (Integer pid, ?boolish raise) -> Process::Status?
|
70
|
+
|
71
|
+
alias self.getpty self.spawn
|
96
72
|
|
97
73
|
# Allocates a pty (pseudo-terminal).
|
98
74
|
#
|
@@ -130,7 +106,7 @@ module PTY
|
|
130
106
|
# ...
|
131
107
|
# }
|
132
108
|
def self.open: () -> [ IO, File ]
|
133
|
-
| () { ([ IO , File ]) ->
|
109
|
+
| [A] () { ([ IO , File ]) -> A } -> A
|
134
110
|
|
135
111
|
# Spawns the specified command on a newly allocated pty. You can also use the
|
136
112
|
# alias ::getpty.
|
@@ -155,5 +131,5 @@ module PTY
|
|
155
131
|
# `pid`
|
156
132
|
# : The process identifier for the command.
|
157
133
|
def self.spawn: (*String command) -> [ IO, IO, Integer ]
|
158
|
-
| (*String command) {([ IO , IO , Integer ]) ->
|
134
|
+
| (*String command) {([ IO , IO , Integer ]) -> void } -> void
|
159
135
|
end
|
data/stdlib/tmpdir/tmpdir.rbs
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
class Dir
|
2
2
|
# Returns the operating system's temporary file path.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
def self.tmpdir: () -> String
|
5
5
|
|
6
6
|
# Dir.mktmpdir creates a temporary directory.
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# The directory is created with 0700 permission. Application should not change
|
9
9
|
# the permission to make the temporary directory accessible from other users.
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The prefix and suffix of the name of the directory is specified by the
|
12
12
|
# optional first argument, *prefix_suffix*.
|
13
13
|
# * If it is not specified or nil, "d" is used as the prefix and no suffix is
|
@@ -15,30 +15,30 @@ class Dir
|
|
15
15
|
# * If it is a string, it is used as the prefix and no suffix is used.
|
16
16
|
# * If it is an array, first element is used as the prefix and second element
|
17
17
|
# is used as a suffix.
|
18
|
-
#
|
19
|
-
#
|
18
|
+
#
|
19
|
+
#
|
20
20
|
# Dir.mktmpdir {|dir| dir is ".../d..." }
|
21
21
|
# Dir.mktmpdir("foo") {|dir| dir is ".../foo..." }
|
22
22
|
# Dir.mktmpdir(["foo", "bar"]) {|dir| dir is ".../foo...bar" }
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# The directory is created under Dir.tmpdir or the optional second argument
|
25
25
|
# *tmpdir* if non-nil value is given.
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# Dir.mktmpdir {|dir| dir is "#{Dir.tmpdir}/d..." }
|
28
28
|
# Dir.mktmpdir(nil, "/var/tmp") {|dir| dir is "/var/tmp/d..." }
|
29
|
-
#
|
29
|
+
#
|
30
30
|
# If a block is given, it is yielded with the path of the directory. The
|
31
31
|
# directory and its contents are removed using FileUtils.remove_entry before
|
32
32
|
# Dir.mktmpdir returns. The value of the block is returned.
|
33
|
-
#
|
33
|
+
#
|
34
34
|
# Dir.mktmpdir {|dir|
|
35
35
|
# # use the directory...
|
36
36
|
# open("#{dir}/foo", "w") { ... }
|
37
37
|
# }
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# If a block is not given, The path of the directory is returned. In this case,
|
40
40
|
# Dir.mktmpdir doesn't remove the directory.
|
41
|
-
#
|
41
|
+
#
|
42
42
|
# dir = Dir.mktmpdir
|
43
43
|
# begin
|
44
44
|
# # use the directory...
|
@@ -47,7 +47,7 @@ class Dir
|
|
47
47
|
# # remove the directory.
|
48
48
|
# FileUtils.remove_entry dir
|
49
49
|
# end
|
50
|
-
#
|
50
|
+
#
|
51
51
|
def self.mktmpdir: (?(String | [ String, String ] | nil), ?String?, ?max_try: Integer?) -> String
|
52
52
|
| [X] (?(String | [ String, String ] | nil), ?String?, ?max_try: Integer?) { (String) -> X } -> X
|
53
53
|
end
|
data/stdlib/uri/generic.rbs
CHANGED
@@ -193,7 +193,7 @@ module URI
|
|
193
193
|
#
|
194
194
|
# Creates a new URI::Generic instance from ``generic'' components without check.
|
195
195
|
#
|
196
|
-
def initialize: (String scheme, String userinfo, String host, Integer port, String? registry, String path, String? opaque, String query, String fragment, ?untyped parser, ?
|
196
|
+
def initialize: (String scheme, String userinfo, String host, Integer port, String? registry, String path, String? opaque, String query, String fragment, ?untyped parser, ?boolish arg_check) -> URI::Generic
|
197
197
|
|
198
198
|
#
|
199
199
|
# Returns the scheme component of the URI.
|
@@ -851,7 +851,7 @@ module URI
|
|
851
851
|
# uri.coerce("http://foo.com")
|
852
852
|
# #=> [#<URI::HTTP http://foo.com>, #<URI::HTTP http://my.example.com>]
|
853
853
|
#
|
854
|
-
def coerce: (
|
854
|
+
def coerce: (URI::Generic | String oth) -> Array[URI::Generic]
|
855
855
|
|
856
856
|
# Returns a proxy URI.
|
857
857
|
# The proxy URI is obtained from environment variables such as http_proxy,
|
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
|