rbs 0.12.2 → 0.13.0
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/CHANGELOG.md +6 -0
- data/Rakefile +2 -2
- 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/environment.rb +4 -0
- data/lib/rbs/environment_loader.rb +12 -12
- data/lib/rbs/variance_calculator.rb +1 -1
- 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/definition_builder.rbs +4 -5
- data/sig/environment_loader.rbs +54 -0
- data/sig/version.rbs +3 -0
- data/sig/writer.rbs +40 -0
- data/stdlib/builtin/kernel.rbs +2 -0
- data/stdlib/pathname/pathname.rbs +2 -0
- data/stdlib/uri/generic.rbs +1 -1
- 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 +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9e733e8a7ed63c585d2a2253728700a7cdca633fd6a7953fb95cda24f423604
|
4
|
+
data.tar.gz: e690e3412cc614e0ce7d8c379e78f2d39d5a2def56f2e7165322db7c421cffd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87bcb3459cb7ef4ac2e56f1047064e0d2b7412d19023ae63b1329e8e40a1dcff3ce3766cfc1086c8447aa2b2e4aea5207e1bf901b25c3f3d49072d90f5a6c694
|
7
|
+
data.tar.gz: 916e9bb2f678fa321862700f386b09b7de88a127e7d4ba92d9b6139f030a865db18a976e51a5820b84caa4c6598aafda876c5e7183a3ed3ff19b8054cfa16842
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.13.0 (2020-09-09)
|
6
|
+
|
7
|
+
* Signature updates for `URI` classes.
|
8
|
+
* Fix tests ([#410](https://github.com/ruby/rbs/pull/410))
|
9
|
+
* Add `--silent` option for `rbs validate` ([#411](https://github.com/ruby/rbs/pull/411))
|
10
|
+
|
5
11
|
## 0.12.2 (2020-09-17)
|
6
12
|
|
7
13
|
* Minor signature update for `pty`
|
data/Rakefile
CHANGED
@@ -25,11 +25,11 @@ task :test_doc => :parser do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
task :validate => :parser do
|
28
|
-
sh "#{ruby} #{rbs} validate"
|
28
|
+
sh "#{ruby} #{rbs} validate --silent"
|
29
29
|
|
30
30
|
FileList["stdlib/*"].each do |path|
|
31
31
|
next if path =~ %r{stdlib/builtin}
|
32
|
-
sh "#{ruby} #{rbs} -r#{File.basename(path)} validate"
|
32
|
+
sh "#{ruby} #{rbs} -r#{File.basename(path)} validate --silent"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
data/lib/rbs/cli.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "open3"
|
1
2
|
require "optparse"
|
2
3
|
require "shellwords"
|
3
4
|
|
@@ -383,6 +384,11 @@ Examples:
|
|
383
384
|
|
384
385
|
$ rbs validate
|
385
386
|
EOU
|
387
|
+
|
388
|
+
opts.on("--silent") do
|
389
|
+
require "stringio"
|
390
|
+
@stdout = StringIO.new
|
391
|
+
end
|
386
392
|
end.parse!(args)
|
387
393
|
|
388
394
|
loader = EnvironmentLoader.new()
|
@@ -488,7 +494,7 @@ Show paths to directories where the RBS files are loaded from.
|
|
488
494
|
Examples:
|
489
495
|
|
490
496
|
$ rbs paths
|
491
|
-
$
|
497
|
+
$ rbs -r set paths
|
492
498
|
EOU
|
493
499
|
end.parse!(args)
|
494
500
|
|
@@ -543,7 +549,7 @@ EOU
|
|
543
549
|
Usage: rbs prototype runtime [options...] [pattern...]
|
544
550
|
|
545
551
|
Generate RBS prototype based on runtime introspection.
|
546
|
-
It loads Ruby code specified in [options] and generates RBS prototypes for classes matches to [pattern].
|
552
|
+
It loads Ruby code specified in [options] and generates RBS prototypes for classes matches to [pattern].
|
547
553
|
|
548
554
|
Examples:
|
549
555
|
|
@@ -808,8 +814,10 @@ EOB
|
|
808
814
|
'RBS_TEST_TARGET' => (targets.join(',') unless targets.empty?)
|
809
815
|
}
|
810
816
|
|
811
|
-
|
812
|
-
|
817
|
+
out, err, status = Open3.capture3(env_hash, *args)
|
818
|
+
stdout.print(out)
|
819
|
+
stderr.print(err)
|
820
|
+
status
|
813
821
|
end
|
814
822
|
end
|
815
823
|
end
|
data/lib/rbs/constant.rb
CHANGED
data/lib/rbs/constant_table.rb
CHANGED
@@ -47,6 +47,8 @@ module RBS
|
|
47
47
|
|
48
48
|
head, *tail = split_name(name)
|
49
49
|
|
50
|
+
raise unless head
|
51
|
+
|
50
52
|
head_constant = case
|
51
53
|
when name.absolute?
|
52
54
|
name_to_constant(TypeName.new(name: head, namespace: Namespace.root))
|
@@ -57,11 +59,13 @@ module RBS
|
|
57
59
|
resolve_constant_reference_inherit(head, scopes: constant_scopes(context.first.to_type_name))
|
58
60
|
end
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
resolve_constant_reference_inherit
|
63
|
-
|
64
|
-
|
62
|
+
tail.inject(head_constant) do |constant, name|
|
63
|
+
if constant
|
64
|
+
resolve_constant_reference_inherit(
|
65
|
+
name,
|
66
|
+
scopes: constant_scopes(constant.name),
|
67
|
+
no_object: constant.name != BuiltinNames::Object.name
|
68
|
+
)
|
65
69
|
end
|
66
70
|
end
|
67
71
|
end
|
@@ -150,9 +154,6 @@ module RBS
|
|
150
154
|
when Environment::ModuleEntry
|
151
155
|
constant_scopes0 BuiltinNames::Module.name, scopes: scopes
|
152
156
|
constant_scopes_module name, scopes: scopes
|
153
|
-
|
154
|
-
else
|
155
|
-
raise "Unexpected declaration: #{name} (#{entry.class})"
|
156
157
|
end
|
157
158
|
|
158
159
|
scopes
|
data/lib/rbs/environment.rb
CHANGED
@@ -258,6 +258,8 @@ module RBS
|
|
258
258
|
outer: outer_,
|
259
259
|
prefix: prefix_
|
260
260
|
)
|
261
|
+
else
|
262
|
+
raise
|
261
263
|
end
|
262
264
|
end,
|
263
265
|
location: decl.location,
|
@@ -288,6 +290,8 @@ module RBS
|
|
288
290
|
outer: outer_,
|
289
291
|
prefix: prefix_
|
290
292
|
)
|
293
|
+
else
|
294
|
+
raise
|
291
295
|
end
|
292
296
|
end,
|
293
297
|
location: decl.location,
|
@@ -9,14 +9,14 @@ module RBS
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
LibraryPath = Struct.new(:name, :path, keyword_init: true)
|
13
|
-
GemPath = Struct.new(:name, :version, :path, keyword_init: true)
|
12
|
+
LibraryPath = _ = Struct.new(:name, :path, keyword_init: true)
|
13
|
+
GemPath = _ = Struct.new(:name, :version, :path, keyword_init: true)
|
14
14
|
|
15
15
|
attr_reader :paths
|
16
16
|
attr_reader :stdlib_root
|
17
17
|
attr_reader :gem_vendor_path
|
18
18
|
|
19
|
-
STDLIB_ROOT = Pathname(__dir__) + "../../stdlib"
|
19
|
+
STDLIB_ROOT = Pathname(_ = __dir__) + "../../stdlib"
|
20
20
|
|
21
21
|
def self.gem_sig_path(name, version)
|
22
22
|
Pathname(Gem::Specification.find_by_name(name, version).gem_dir) + "sig"
|
@@ -50,22 +50,20 @@ module RBS
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def self.parse_library(lib)
|
53
|
-
lib.split(/:/)
|
53
|
+
_ = lib.split(/:/)
|
54
54
|
end
|
55
55
|
|
56
56
|
def stdlib?(name)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
path
|
61
|
-
end
|
57
|
+
path = stdlib_root + name
|
58
|
+
if path.directory?
|
59
|
+
path
|
62
60
|
end
|
63
61
|
end
|
64
62
|
|
65
63
|
def gem?(name, version)
|
66
|
-
if gem_vendor_path
|
64
|
+
if path = gem_vendor_path
|
67
65
|
# Try vendored RBS first
|
68
|
-
gem_dir =
|
66
|
+
gem_dir = path + name
|
69
67
|
if gem_dir.directory?
|
70
68
|
return gem_dir
|
71
69
|
end
|
@@ -76,7 +74,7 @@ module RBS
|
|
76
74
|
end
|
77
75
|
|
78
76
|
def each_signature(path, immediate: true, &block)
|
79
|
-
if
|
77
|
+
if block
|
80
78
|
case
|
81
79
|
when path.file?
|
82
80
|
if path.extname == ".rbs" || immediate
|
@@ -116,6 +114,7 @@ module RBS
|
|
116
114
|
|
117
115
|
def each_decl
|
118
116
|
if block_given?
|
117
|
+
# @type var signature_files: Array[[path | :stdlib, Pathname]]
|
119
118
|
signature_files = []
|
120
119
|
|
121
120
|
unless no_builtin?
|
@@ -142,6 +141,7 @@ module RBS
|
|
142
141
|
end
|
143
142
|
|
144
143
|
def load(env:)
|
144
|
+
# @type var loadeds: Array[[AST::Declarations::t, Pathname, path | :stdlib]]
|
145
145
|
loadeds = []
|
146
146
|
|
147
147
|
each_decl do |decl, buffer, file_path, lib_path|
|
data/lib/rbs/version.rb
CHANGED
data/lib/rbs/writer.rb
CHANGED
@@ -60,6 +60,8 @@ module RBS
|
|
60
60
|
|
61
61
|
def write(decls)
|
62
62
|
[nil, *decls].each_cons(2) do |prev, decl|
|
63
|
+
raise unless decl
|
64
|
+
|
63
65
|
preserve_empty_line(prev, decl)
|
64
66
|
write_decl decl
|
65
67
|
end
|
@@ -68,8 +70,8 @@ module RBS
|
|
68
70
|
def write_decl(decl)
|
69
71
|
case decl
|
70
72
|
when AST::Declarations::Class
|
71
|
-
super_class = if decl.super_class
|
72
|
-
" < #{name_and_args(
|
73
|
+
super_class = if super_class = decl.super_class
|
74
|
+
" < #{name_and_args(super_class.name, super_class.args)}"
|
73
75
|
end
|
74
76
|
write_comment decl.comment
|
75
77
|
write_annotation decl.annotations
|
@@ -77,6 +79,8 @@ module RBS
|
|
77
79
|
|
78
80
|
indent do
|
79
81
|
[nil, *decl.members].each_cons(2) do |prev, member|
|
82
|
+
raise unless member
|
83
|
+
|
80
84
|
preserve_empty_line prev, member
|
81
85
|
write_member member
|
82
86
|
end
|
@@ -134,9 +138,6 @@ module RBS
|
|
134
138
|
|
135
139
|
puts "end"
|
136
140
|
|
137
|
-
when AST::Declarations::Extension
|
138
|
-
RBS.logger.warn "Extension is ignored: #{decl.name}"
|
139
|
-
|
140
141
|
end
|
141
142
|
end
|
142
143
|
|
@@ -288,20 +289,29 @@ module RBS
|
|
288
289
|
end
|
289
290
|
|
290
291
|
def preserve_empty_line(prev, decl)
|
291
|
-
|
292
|
+
# @type var decl: _Located
|
292
293
|
|
293
|
-
|
294
|
+
return unless prev
|
294
295
|
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
return
|
296
|
+
if (_ = decl).respond_to?(:comment)
|
297
|
+
if comment = (_ = decl).comment
|
298
|
+
decl = comment
|
299
|
+
end
|
300
300
|
end
|
301
301
|
|
302
|
-
|
303
|
-
|
304
|
-
|
302
|
+
prev_loc = prev.location
|
303
|
+
decl_loc = decl.location
|
304
|
+
|
305
|
+
if prev_loc && decl_loc
|
306
|
+
prev_end_line = prev_loc.end_line
|
307
|
+
start_line = decl_loc.start_line
|
308
|
+
|
309
|
+
if start_line - prev_end_line > 1
|
310
|
+
puts
|
311
|
+
end
|
312
|
+
else
|
313
|
+
# When the signature is not constructed by the parser,
|
314
|
+
# it always inserts an empty line.
|
305
315
|
puts
|
306
316
|
end
|
307
317
|
end
|
data/sig/constant.rbs
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module RBS
|
2
|
+
class Constant
|
3
|
+
type constant_entry = Environment::ClassEntry
|
4
|
+
| Environment::ModuleEntry
|
5
|
+
| Environment::SingleEntry[TypeName, AST::Declarations::Constant]
|
6
|
+
|
7
|
+
attr_reader name: TypeName
|
8
|
+
|
9
|
+
attr_reader type: Types::t
|
10
|
+
|
11
|
+
attr_reader entry: constant_entry
|
12
|
+
|
13
|
+
def initialize: (name: TypeName, type: Types::t, entry: constant_entry) -> void
|
14
|
+
|
15
|
+
def ==: (untyped other) -> bool
|
16
|
+
|
17
|
+
alias eql? ==
|
18
|
+
|
19
|
+
def hash: () -> Integer
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module RBS
|
2
|
+
class ConstantTable
|
3
|
+
attr_reader definition_builder: DefinitionBuilder
|
4
|
+
attr_reader constant_scopes_cache: Hash[TypeName, Array[Namespace]]
|
5
|
+
attr_reader resolver: TypeNameResolver
|
6
|
+
attr_reader env(): Environment
|
7
|
+
|
8
|
+
def initialize: (builder: DefinitionBuilder) -> void
|
9
|
+
|
10
|
+
def absolute_type: (Types::t, context: Array[Namespace]) -> Types::t
|
11
|
+
|
12
|
+
def absolute_type_name: (TypeName, context: Array[Namespace], location: Location?) -> TypeName
|
13
|
+
|
14
|
+
def name_to_constant: (TypeName) -> Constant?
|
15
|
+
|
16
|
+
def split_name: (TypeName) -> Array[Symbol]
|
17
|
+
|
18
|
+
def resolve_constant_reference: (TypeName name, context: Array[Namespace]) -> Constant?
|
19
|
+
|
20
|
+
def resolve_constant_reference_context: (Symbol, context: Array[Namespace]) -> Constant?
|
21
|
+
|
22
|
+
def resolve_constant_reference_inherit: (Symbol, scopes: Array[Namespace], ?no_object: bool) -> Constant?
|
23
|
+
|
24
|
+
def constant_scopes: (TypeName) -> Array[Namespace]
|
25
|
+
|
26
|
+
def constant_scopes_module: (TypeName, scopes: Array[Namespace]) -> Array[Namespace]
|
27
|
+
|
28
|
+
def constant_scopes0: (TypeName, ?scopes: Array[Namespace]) -> Array[Namespace]
|
29
|
+
end
|
30
|
+
end
|
data/sig/definition_builder.rbs
CHANGED
@@ -29,14 +29,14 @@ module RBS
|
|
29
29
|
|
30
30
|
attr_reader env: Environment
|
31
31
|
attr_reader type_name_resolver: TypeNameResolver
|
32
|
-
|
32
|
+
|
33
33
|
attr_reader instance_cache: Hash[TypeName, Definition | false | nil]
|
34
34
|
attr_reader singleton_cache: Hash[TypeName, Definition | false | nil]
|
35
35
|
attr_reader interface_cache: Hash[TypeName, Definition | false | nil]
|
36
36
|
|
37
37
|
attr_reader one_instance_cache: Hash[TypeName, Definition]
|
38
38
|
attr_reader one_singleton_cache: Hash[TypeName, Definition]
|
39
|
-
|
39
|
+
|
40
40
|
attr_reader instance_ancestors_cache: Hash[TypeName, Definition::InstanceAncestors]
|
41
41
|
attr_reader singleton_ancestor_cache: Hash[TypeName, Definition::SingletonAncestors]
|
42
42
|
|
@@ -48,7 +48,7 @@ module RBS
|
|
48
48
|
def validate_super_class!: (TypeName, Environment::ClassEntry) -> void
|
49
49
|
|
50
50
|
def one_instance_ancestors: (TypeName) -> OneAncestors
|
51
|
-
|
51
|
+
|
52
52
|
def one_singleton_ancestors: (TypeName) -> OneAncestors
|
53
53
|
|
54
54
|
def instance_ancestors: (TypeName, ?building_ancestors: Array[Definition::Ancestor::t]) -> Definition::InstanceAncestors
|
@@ -69,7 +69,7 @@ module RBS
|
|
69
69
|
|
70
70
|
def build_one_singleton: (TypeName) -> Definition
|
71
71
|
|
72
|
-
def merge_definitions: (TypeName,
|
72
|
+
def merge_definitions: (TypeName,
|
73
73
|
Array[[Definition::Ancestor::t, Definition]],
|
74
74
|
entry: Environment::ModuleEntry | Environment::ClassEntry,
|
75
75
|
self_type: Definition::self_type,
|
@@ -92,4 +92,3 @@ module RBS
|
|
92
92
|
def expand_alias: (TypeName) -> Types::t
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
data/sig/environment_loader.rbs
CHANGED
@@ -1,4 +1,58 @@
|
|
1
1
|
module RBS
|
2
2
|
class EnvironmentLoader
|
3
|
+
class UnknownLibraryNameError < StandardError
|
4
|
+
attr_reader name: String
|
5
|
+
|
6
|
+
def initialize: (name: String) -> void
|
7
|
+
end
|
8
|
+
|
9
|
+
class LibraryPath
|
10
|
+
attr_reader name: String
|
11
|
+
attr_reader path: Pathname
|
12
|
+
|
13
|
+
def initialize: (name: String, path: Pathname) -> void
|
14
|
+
end
|
15
|
+
|
16
|
+
class GemPath
|
17
|
+
attr_reader name: String
|
18
|
+
attr_reader version: String?
|
19
|
+
attr_reader path: Pathname
|
20
|
+
|
21
|
+
def initialize: (name: String, version: String?, path: Pathname) -> void
|
22
|
+
end
|
23
|
+
|
24
|
+
STDLIB_ROOT: Pathname
|
25
|
+
|
26
|
+
type path = Pathname | LibraryPath | GemPath
|
27
|
+
|
28
|
+
attr_reader paths: Array[path]
|
29
|
+
attr_reader stdlib_root: Pathname
|
30
|
+
attr_reader gem_vendor_path: Pathname?
|
31
|
+
|
32
|
+
def self.gem_sig_path: (String, String?) -> Pathname?
|
33
|
+
|
34
|
+
def initialize: (?stdlib_root: Pathname, ?gem_vendor_path: Pathname?) -> void
|
35
|
+
|
36
|
+
def add: (path: Pathname?) -> void
|
37
|
+
| (library: String?) -> void
|
38
|
+
|
39
|
+
def self.parse_library: (String) -> [String, String?]
|
40
|
+
|
41
|
+
def stdlib?: (String) -> Pathname?
|
42
|
+
|
43
|
+
def gem?: (String, String?) -> Pathname?
|
44
|
+
|
45
|
+
def each_signature: (Pathname, ?immediate: bool) { (Pathname) -> void } -> void
|
46
|
+
| (Pathname, ?immediate: bool) -> Enumerator[Pathname, void]
|
47
|
+
|
48
|
+
def each_library_path: { (path, Pathname) -> void } -> void
|
49
|
+
|
50
|
+
def no_builtin!: (?bool) -> self
|
51
|
+
|
52
|
+
def no_builtin?: () -> bool
|
53
|
+
|
54
|
+
def each_decl: () { (AST::Declarations::t, Buffer, Pathname, path | :stdlib) -> void } -> void
|
55
|
+
|
56
|
+
def load: (env: Environment) -> Array[[AST::Declarations::t, Pathname, path | :stdlib]]
|
3
57
|
end
|
4
58
|
end
|
data/sig/version.rbs
ADDED
data/sig/writer.rbs
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module RBS
|
2
|
+
class Writer
|
3
|
+
attr_reader out: IO
|
4
|
+
attr_reader indentation: Array[String]
|
5
|
+
|
6
|
+
def initialize: (out: IO) -> void
|
7
|
+
|
8
|
+
def indent: (?Integer size) { () -> void } -> void
|
9
|
+
|
10
|
+
def prefix: () -> String
|
11
|
+
|
12
|
+
def puts: (?String) -> void
|
13
|
+
|
14
|
+
def write_annotation: (Array[AST::Annotation]) -> void
|
15
|
+
|
16
|
+
def write_comment: (AST::Comment?) -> void
|
17
|
+
|
18
|
+
def write: (Array[AST::Declarations::t]) -> void
|
19
|
+
|
20
|
+
def write_decl: (AST::Declarations::t) -> void
|
21
|
+
|
22
|
+
def write_member: (AST::Declarations::Module::member) -> void
|
23
|
+
|
24
|
+
def name_and_params: (TypeName, AST::Declarations::ModuleTypeParams) -> String?
|
25
|
+
|
26
|
+
def name_and_args: (TypeName, Array[Types::t]) -> String?
|
27
|
+
|
28
|
+
def method_name: (Symbol) -> String
|
29
|
+
|
30
|
+
def write_def: (AST::Members::MethodDefinition) -> void
|
31
|
+
|
32
|
+
def attribute: (:reader | :writer | :accessor, AST::Members::Attribute) -> void
|
33
|
+
|
34
|
+
interface _Located
|
35
|
+
def location: () -> Location?
|
36
|
+
end
|
37
|
+
|
38
|
+
def preserve_empty_line: (_Located?, _Located) -> void
|
39
|
+
end
|
40
|
+
end
|
data/stdlib/builtin/kernel.rbs
CHANGED
data/stdlib/uri/generic.rbs
CHANGED
@@ -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
|
@@ -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 LDAPS URIs is 636, and the scheme is 'ldaps:' rather
|
102
|
+
# than 'ldap:'. Other than that, LDAPS URIs are identical to LDAP URIs;
|
103
|
+
# see URI::LDAP.
|
104
|
+
class LDAPS < LDAP
|
105
|
+
# A Default port of 636 for URI::LDAPS
|
106
|
+
DEFAULT_PORT: Integer
|
107
|
+
end
|
108
|
+
end
|
data/steep/Gemfile.lock
CHANGED
@@ -1,19 +1,7 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ../../steep
|
3
|
-
specs:
|
4
|
-
steep (0.27.0)
|
5
|
-
activesupport (>= 5.1)
|
6
|
-
ast_utils (~> 0.3.0)
|
7
|
-
language_server-protocol (~> 3.14.0.2)
|
8
|
-
listen (~> 3.1)
|
9
|
-
parser (~> 2.7.0)
|
10
|
-
rainbow (>= 2.2.2, < 4.0)
|
11
|
-
rbs (~> 0.11.0)
|
12
|
-
|
13
1
|
GEM
|
14
2
|
remote: https://rubygems.org/
|
15
3
|
specs:
|
16
|
-
activesupport (6.0.3.
|
4
|
+
activesupport (6.0.3.3)
|
17
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
6
|
i18n (>= 0.7, < 2)
|
19
7
|
minitest (~> 5.1)
|
@@ -32,13 +20,21 @@ GEM
|
|
32
20
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
33
21
|
rb-inotify (~> 0.9, >= 0.9.10)
|
34
22
|
minitest (5.14.2)
|
35
|
-
parser (2.7.1.
|
23
|
+
parser (2.7.1.5)
|
36
24
|
ast (~> 2.4.1)
|
37
25
|
rainbow (3.0.0)
|
38
26
|
rb-fsevent (0.10.4)
|
39
27
|
rb-inotify (0.10.1)
|
40
28
|
ffi (~> 1.0)
|
41
|
-
rbs (0.
|
29
|
+
rbs (0.12.2)
|
30
|
+
steep (0.28.0)
|
31
|
+
activesupport (>= 5.1)
|
32
|
+
ast_utils (~> 0.3.0)
|
33
|
+
language_server-protocol (~> 3.14.0.2)
|
34
|
+
listen (~> 3.1)
|
35
|
+
parser (~> 2.7.0)
|
36
|
+
rainbow (>= 2.2.2, < 4.0)
|
37
|
+
rbs (~> 0.12.0)
|
42
38
|
thor (1.0.1)
|
43
39
|
thread_safe (0.3.6)
|
44
40
|
tzinfo (1.2.7)
|
@@ -49,7 +45,7 @@ PLATFORMS
|
|
49
45
|
ruby
|
50
46
|
|
51
47
|
DEPENDENCIES
|
52
|
-
steep
|
48
|
+
steep
|
53
49
|
|
54
50
|
BUNDLED WITH
|
55
|
-
2.1.
|
51
|
+
2.1.4
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09
|
11
|
+
date: 2020-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: RBS is the language for type signatures for Ruby and standard library
|
14
14
|
definitions.
|
@@ -101,6 +101,8 @@ files:
|
|
101
101
|
- sig/buffer.rbs
|
102
102
|
- sig/builtin_names.rbs
|
103
103
|
- sig/comment.rbs
|
104
|
+
- sig/constant.rbs
|
105
|
+
- sig/constant_table.rbs
|
104
106
|
- sig/declarations.rbs
|
105
107
|
- sig/definition.rbs
|
106
108
|
- sig/definition_builder.rbs
|
@@ -118,6 +120,8 @@ files:
|
|
118
120
|
- sig/types.rbs
|
119
121
|
- sig/util.rbs
|
120
122
|
- sig/variance_calculator.rbs
|
123
|
+
- sig/version.rbs
|
124
|
+
- sig/writer.rbs
|
121
125
|
- stdlib/abbrev/abbrev.rbs
|
122
126
|
- stdlib/base64/base64.rbs
|
123
127
|
- stdlib/benchmark/benchmark.rbs
|
@@ -204,6 +208,10 @@ files:
|
|
204
208
|
- stdlib/tmpdir/tmpdir.rbs
|
205
209
|
- stdlib/uri/file.rbs
|
206
210
|
- stdlib/uri/generic.rbs
|
211
|
+
- stdlib/uri/http.rbs
|
212
|
+
- stdlib/uri/https.rbs
|
213
|
+
- stdlib/uri/ldap.rbs
|
214
|
+
- stdlib/uri/ldaps.rbs
|
207
215
|
- stdlib/zlib/zlib.rbs
|
208
216
|
- steep/Gemfile
|
209
217
|
- steep/Gemfile.lock
|