rbs 1.0.4 → 1.0.5
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 +12 -0
- data/core/array.rbs +2 -2
- data/core/complex.rbs +1 -1
- data/core/enumerable.rbs +15 -1
- data/core/file.rbs +2 -1
- data/core/integer.rbs +2 -1
- data/core/module.rbs +1 -1
- data/core/rational.rbs +2 -1
- data/core/string.rbs +2 -1
- data/core/symbol.rbs +2 -1
- data/core/time.rbs +2 -1
- data/lib/rbs/ast/members.rb +13 -0
- data/lib/rbs/definition_builder.rb +12 -5
- data/lib/rbs/definition_builder/method_builder.rb +9 -2
- data/lib/rbs/version.rb +1 -1
- data/sig/members.rbs +2 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +1 -1
- data/stdlib/date/0/date.rbs +1 -1
- data/stdlib/json/0/json.rbs +64 -0
- data/stdlib/pathname/0/pathname.rbs +2 -1
- data/stdlib/set/0/set.rbs +7 -0
- data/stdlib/timeout/0/timeout.rbs +57 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +144 -7
- data/steep/Gemfile.lock +17 -19
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96101c70eb61ad35fb0589861eb35f96a194b9de0e6e0f879237f3c5afea2a60
|
4
|
+
data.tar.gz: 8ca6a02529d655a6c4099b5f9da6ff63ec09159c8fcf2d4a43f60a615aa6b44d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffeed46652774774276a0efb9285b53b979fefa0bbf1fd6bdd8aba7fd76172f352313acdfaca64c89dd63332aa346d87785c56b8ff5e8911bf0228a22d8cf5c2
|
7
|
+
data.tar.gz: 4c6bce345c37c5b76b1563a204a7334cbaf99a1e4b34ac2fb88edcf143a1f67d91fef1f3fa16112faa403e644556c92154fa23a7f3c8bcdd45190fc4f042a369
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.0.5 (2021-02-13)
|
6
|
+
|
7
|
+
* Signature Updates
|
8
|
+
* Enumerable ([\#596](https://github.com/ruby/rbs/pull/596))
|
9
|
+
* Set ([\#595](https://github.com/ruby/rbs/pull/595))
|
10
|
+
* `#to_json` ([\#592](https://github.com/ruby/rbs/pull/592))
|
11
|
+
* `<=>` ([\#593](https://github.com/ruby/rbs/pull/593))
|
12
|
+
* Timeout ([\#586](https://github.com/ruby/rbs/pull/586))
|
13
|
+
* URI::RFC2396_Parser ([\#587](https://github.com/ruby/rbs/pull/587))
|
14
|
+
* Rename generic class parameters on re-open ([\#594](https://github.com/ruby/rbs/pull/594))
|
15
|
+
* Make `refute_send_type` check that method call doesn't match with types in RBS ([\#588](https://github.com/ruby/rbs/pull/588))
|
16
|
+
|
5
17
|
## 1.0.4 (2021-01-31)
|
6
18
|
|
7
19
|
* Unbundle `rr` to run test in `ruby/ruby` repo ([#585](https://github.com/ruby/rbs/pull/585))
|
data/core/array.rbs
CHANGED
@@ -1736,7 +1736,7 @@ class Array[unchecked out Elem] < Object
|
|
1736
1736
|
# See also Enumerable#sort_by.
|
1737
1737
|
#
|
1738
1738
|
def sort: () -> ::Array[Elem]
|
1739
|
-
| () { (Elem a, Elem b) -> ::Integer
|
1739
|
+
| () { (Elem a, Elem b) -> ::Integer } -> ::Array[Elem]
|
1740
1740
|
|
1741
1741
|
# Sorts `self` in place.
|
1742
1742
|
#
|
@@ -1757,7 +1757,7 @@ class Array[unchecked out Elem] < Object
|
|
1757
1757
|
# See also Enumerable#sort_by.
|
1758
1758
|
#
|
1759
1759
|
def sort!: () -> self
|
1760
|
-
| () { (Elem a, Elem b) -> ::Integer
|
1760
|
+
| () { (Elem a, Elem b) -> ::Integer } -> self
|
1761
1761
|
|
1762
1762
|
# Sorts `self` in place using a set of keys generated by mapping the values in
|
1763
1763
|
# `self` through the given block.
|
data/core/complex.rbs
CHANGED
data/core/enumerable.rbs
CHANGED
@@ -286,8 +286,22 @@ module Enumerable[unchecked out Elem]: _Each[Elem]
|
|
286
286
|
def sort_by: () { (Elem arg0) -> (Comparable | ::Array[untyped]) } -> ::Array[Elem]
|
287
287
|
| () -> ::Enumerator[Elem, ::Array[Elem]]
|
288
288
|
|
289
|
-
|
289
|
+
# Returns first n elements from *enum*.
|
290
|
+
#
|
291
|
+
# a = [1, 2, 3, 4, 5, 0]
|
292
|
+
# a.take(3) #=> [1, 2, 3]
|
293
|
+
# a.take(30) #=> [1, 2, 3, 4, 5, 0]
|
294
|
+
#
|
295
|
+
def take: (Integer n) -> ::Array[Elem]
|
290
296
|
|
297
|
+
# Passes elements to the block until the block returns `nil` or `false`, then
|
298
|
+
# stops iterating and returns an array of all prior elements.
|
299
|
+
#
|
300
|
+
# If no block is given, an enumerator is returned instead.
|
301
|
+
#
|
302
|
+
# a = [1, 2, 3, 4, 5, 0]
|
303
|
+
# a.take_while { |i| i < 3 } #=> [1, 2]
|
304
|
+
#
|
291
305
|
def take_while: () { (Elem) -> boolish } -> ::Array[Elem]
|
292
306
|
| () -> ::Enumerator[Elem, ::Array[Elem]]
|
293
307
|
|
data/core/file.rbs
CHANGED
data/core/integer.rbs
CHANGED
@@ -112,7 +112,8 @@ class Integer < Numeric
|
|
112
112
|
#
|
113
113
|
# `nil` is returned if the two values are incomparable.
|
114
114
|
#
|
115
|
-
def <=>: (
|
115
|
+
def <=>: (Integer | Rational) -> Integer
|
116
|
+
| (untyped) -> Integer?
|
116
117
|
|
117
118
|
# Returns `true` if `int` equals `other` numerically. Contrast this with
|
118
119
|
# Integer#eql?, which requires `other` to be an Integer.
|
data/core/module.rbs
CHANGED
@@ -90,7 +90,7 @@ class Module < Object
|
|
90
90
|
# Returns `nil` if `module` has no relationship with `other_module`, if
|
91
91
|
# `other_module` is not a module, or if the two values are incomparable.
|
92
92
|
#
|
93
|
-
def <=>: (
|
93
|
+
def <=>: (untyped other) -> Integer?
|
94
94
|
|
95
95
|
# Equality --- At the Object level, #== returns `true` only if `obj` and `other`
|
96
96
|
# are the same object. Typically, this method is overridden in descendant
|
data/core/rational.rbs
CHANGED
@@ -125,7 +125,8 @@ class Rational < Numeric
|
|
125
125
|
#
|
126
126
|
# Rational(1, 3) <=> "0.3" #=> nil
|
127
127
|
#
|
128
|
-
def <=>: (
|
128
|
+
def <=>: (Integer | Rational) -> Integer
|
129
|
+
| (untyped) -> Integer?
|
129
130
|
|
130
131
|
# Returns `true` if `rat` equals `object` numerically.
|
131
132
|
#
|
data/core/string.rbs
CHANGED
@@ -91,7 +91,8 @@ class String
|
|
91
91
|
# "abcdef" <=> "ABCDEF" #=> 1
|
92
92
|
# "abcdef" <=> 1 #=> nil
|
93
93
|
#
|
94
|
-
def <=>: (
|
94
|
+
def <=>: (string other) -> Integer
|
95
|
+
| (untyped other) -> Integer?
|
95
96
|
|
96
97
|
# Equality---Returns whether `str` == `obj`, similar to Object#==.
|
97
98
|
#
|
data/core/symbol.rbs
CHANGED
@@ -47,7 +47,8 @@ class Symbol
|
|
47
47
|
#
|
48
48
|
# See String#<=> for more information.
|
49
49
|
#
|
50
|
-
def <=>: (
|
50
|
+
def <=>: (Symbol other) -> Integer
|
51
|
+
| (untyped other) -> Integer?
|
51
52
|
|
52
53
|
# Equality---If *sym* and *obj* are exactly the same symbol, returns `true`.
|
53
54
|
#
|
data/core/time.rbs
CHANGED
data/lib/rbs/ast/members.rb
CHANGED
@@ -245,6 +245,19 @@ module RBS
|
|
245
245
|
def hash
|
246
246
|
self.class.hash ^ name.hash ^ type.hash ^ ivar_name.hash ^ kind.hash
|
247
247
|
end
|
248
|
+
|
249
|
+
def update(name: self.name, type: self.type, ivar_name: self.ivar_name, kind: self.kind, annotations: self.annotations, location: self.location, comment: self.comment)
|
250
|
+
klass = _ = self.class
|
251
|
+
klass.new(
|
252
|
+
name: name,
|
253
|
+
type: type,
|
254
|
+
ivar_name: ivar_name,
|
255
|
+
kind: kind,
|
256
|
+
annotations: annotations,
|
257
|
+
location: location,
|
258
|
+
comment: comment
|
259
|
+
)
|
260
|
+
end
|
248
261
|
end
|
249
262
|
|
250
263
|
class AttrReader < Base
|
@@ -139,9 +139,8 @@ module RBS
|
|
139
139
|
case entry
|
140
140
|
when Environment::ClassEntry, Environment::ModuleEntry
|
141
141
|
ancestors = ancestor_builder.instance_ancestors(type_name)
|
142
|
-
|
143
|
-
|
144
|
-
location: nil)
|
142
|
+
args = Types::Variable.build(entry.type_params.each.map(&:name))
|
143
|
+
self_type = Types::ClassInstance.new(name: type_name, args: args, location: nil)
|
145
144
|
|
146
145
|
Definition.new(type_name: type_name, entry: entry, self_type: self_type, ancestors: ancestors).tap do |definition|
|
147
146
|
one_ancestors = ancestor_builder.one_instance_ancestors(type_name)
|
@@ -217,6 +216,8 @@ module RBS
|
|
217
216
|
super_interface_method: entry.is_a?(Environment::ModuleEntry))
|
218
217
|
|
219
218
|
entry.decls.each do |d|
|
219
|
+
subst = Substitution.build(d.decl.type_params.each.map(&:name), args)
|
220
|
+
|
220
221
|
d.decl.members.each do |member|
|
221
222
|
case member
|
222
223
|
when AST::Members::AttrReader, AST::Members::AttrAccessor, AST::Members::AttrWriter
|
@@ -229,12 +230,18 @@ module RBS
|
|
229
230
|
end
|
230
231
|
|
231
232
|
if ivar_name
|
232
|
-
insert_variable(type_name,
|
233
|
+
insert_variable(type_name,
|
234
|
+
definition.instance_variables,
|
235
|
+
name: ivar_name,
|
236
|
+
type: member.type.sub(subst))
|
233
237
|
end
|
234
238
|
end
|
235
239
|
|
236
240
|
when AST::Members::InstanceVariable
|
237
|
-
insert_variable(type_name,
|
241
|
+
insert_variable(type_name,
|
242
|
+
definition.instance_variables,
|
243
|
+
name: member.name,
|
244
|
+
type: member.type.sub(subst))
|
238
245
|
|
239
246
|
when AST::Members::ClassVariable
|
240
247
|
insert_variable(type_name, definition.class_variables, name: member.name, type: member.type)
|
@@ -96,15 +96,22 @@ module RBS
|
|
96
96
|
type = Types::ClassInstance.new(name: type_name, args: args, location: nil)
|
97
97
|
Methods.new(type: type).tap do |methods|
|
98
98
|
entry.decls.each do |d|
|
99
|
+
subst = Substitution.build(d.decl.type_params.each.map(&:name), args)
|
99
100
|
each_member_with_accessibility(d.decl.members) do |member, accessibility|
|
100
101
|
case member
|
101
102
|
when AST::Members::MethodDefinition
|
102
103
|
if member.instance?
|
103
|
-
build_method(methods,
|
104
|
+
build_method(methods,
|
105
|
+
type,
|
106
|
+
member: member.update(types: member.types.map {|type| type.sub(subst) }),
|
107
|
+
accessibility: accessibility)
|
104
108
|
end
|
105
109
|
when AST::Members::AttrReader, AST::Members::AttrWriter, AST::Members::AttrAccessor
|
106
110
|
if member.kind == :instance
|
107
|
-
build_attribute(methods,
|
111
|
+
build_attribute(methods,
|
112
|
+
type,
|
113
|
+
member: member.update(type: member.type.sub(subst)),
|
114
|
+
accessibility: accessibility)
|
108
115
|
end
|
109
116
|
when AST::Members::Alias
|
110
117
|
if member.kind == :instance
|
data/lib/rbs/version.rb
CHANGED
data/sig/members.rbs
CHANGED
@@ -104,6 +104,8 @@ module RBS
|
|
104
104
|
def initialize: (name: Symbol, type: Types::t, ivar_name: Symbol | false | nil, kind: kind, annotations: Array[Annotation], location: Location?, comment: Comment?) -> void
|
105
105
|
|
106
106
|
include _HashEqual
|
107
|
+
|
108
|
+
def update: (?name: Symbol, ?type: Types::t, ?ivar_name: Symbol | false | nil, ?kind: kind, ?annotations: Array[Annotation], ?location: Location?, ?comment: Comment?) -> instance
|
107
109
|
end
|
108
110
|
|
109
111
|
class AttrReader < Base
|
@@ -321,7 +321,7 @@ class BigDecimal < Numeric
|
|
321
321
|
|
322
322
|
# The comparison operator. a <=> b is 0 if a == b, 1 if a > b, -1 if a < b.
|
323
323
|
#
|
324
|
-
def <=>: (
|
324
|
+
def <=>: (untyped) -> Integer?
|
325
325
|
|
326
326
|
# Tests for value equality; returns true if the values are equal.
|
327
327
|
#
|
data/stdlib/date/0/date.rbs
CHANGED
data/stdlib/json/0/json.rbs
CHANGED
@@ -339,3 +339,67 @@ JSON::VERSION_BUILD: Integer
|
|
339
339
|
JSON::VERSION_MAJOR: Integer
|
340
340
|
|
341
341
|
JSON::VERSION_MINOR: Integer
|
342
|
+
|
343
|
+
class Object
|
344
|
+
# Converts this object to a string (calling #to_s), converts
|
345
|
+
# it to a JSON string, and returns the result. This is a fallback, if no
|
346
|
+
# special method #to_json was defined for some object.
|
347
|
+
#
|
348
|
+
def to_json: (?JSON::State state) -> String
|
349
|
+
end
|
350
|
+
|
351
|
+
class NilClass
|
352
|
+
# Returns a JSON string for nil: 'null'.
|
353
|
+
#
|
354
|
+
def to_json: (?JSON::State state) -> String
|
355
|
+
end
|
356
|
+
|
357
|
+
class TrueClass
|
358
|
+
# Returns a JSON string for true: 'true'.
|
359
|
+
#
|
360
|
+
def to_json: (?JSON::State state) -> String
|
361
|
+
end
|
362
|
+
|
363
|
+
class FalseClass
|
364
|
+
# Returns a JSON string for false: 'false'.
|
365
|
+
#
|
366
|
+
def to_json: (?JSON::State state) -> String
|
367
|
+
end
|
368
|
+
|
369
|
+
class String
|
370
|
+
# This string should be encoded with UTF-8 A call to this method
|
371
|
+
# returns a JSON string encoded with UTF16 big endian characters as
|
372
|
+
# \u????.
|
373
|
+
#
|
374
|
+
def to_json: (?JSON::State state) -> String
|
375
|
+
end
|
376
|
+
|
377
|
+
class Integer
|
378
|
+
# Returns a JSON string representation for this Integer number.
|
379
|
+
#
|
380
|
+
def to_json: (?JSON::State state) -> String
|
381
|
+
end
|
382
|
+
|
383
|
+
class Float
|
384
|
+
# Returns a JSON string representation for this Float number.
|
385
|
+
#
|
386
|
+
def to_json: (?JSON::State state) -> String
|
387
|
+
end
|
388
|
+
|
389
|
+
class Hash[unchecked out K, unchecked out V]
|
390
|
+
# Returns a JSON string containing a JSON object, that is generated from
|
391
|
+
# this Hash instance.
|
392
|
+
# _state_ is a JSON::State object, that can also be used to configure the
|
393
|
+
# produced JSON string output further.
|
394
|
+
#
|
395
|
+
def to_json: (?JSON::State state) -> String
|
396
|
+
end
|
397
|
+
|
398
|
+
class Array[unchecked out Elem]
|
399
|
+
# Returns a JSON string containing a JSON array, that is generated from
|
400
|
+
# this Array instance.
|
401
|
+
# _state_ is a JSON::State object, that can also be used to configure the
|
402
|
+
# produced JSON string output further.
|
403
|
+
#
|
404
|
+
def to_json: (?JSON::State state) -> String
|
405
|
+
end
|
@@ -240,7 +240,8 @@ class Pathname
|
|
240
240
|
# relative to the right argument. Or it will return `nil` if the arguments are
|
241
241
|
# not comparable.
|
242
242
|
#
|
243
|
-
def <=>: (
|
243
|
+
def <=>: (Pathname other) -> Integer
|
244
|
+
| (untyped other) -> nil
|
244
245
|
|
245
246
|
# Compare this pathname with `other`. The comparison is string-based. Be aware
|
246
247
|
# that two different paths (`foo.txt` and `./foo.txt`) can refer to the same
|
data/stdlib/set/0/set.rbs
CHANGED
@@ -299,3 +299,10 @@ class Set[A]
|
|
299
299
|
|
300
300
|
include Enumerable[A]
|
301
301
|
end
|
302
|
+
|
303
|
+
module Enumerable[unchecked out Elem]
|
304
|
+
# Makes a set from the enumerable object with given arguments.
|
305
|
+
# Needs to `require "set"` to use this method.
|
306
|
+
#
|
307
|
+
def to_set: () -> Set[Elem]
|
308
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Timeout long-running blocks
|
2
|
+
#
|
3
|
+
# ## Synopsis
|
4
|
+
#
|
5
|
+
# require 'timeout'
|
6
|
+
# status = Timeout::timeout(5) {
|
7
|
+
# # Something that should be interrupted if it takes more than 5 seconds...
|
8
|
+
# }
|
9
|
+
#
|
10
|
+
# ## Description
|
11
|
+
#
|
12
|
+
# Timeout provides a way to auto-terminate a potentially long-running operation
|
13
|
+
# if it hasn't finished in a fixed amount of time.
|
14
|
+
#
|
15
|
+
# Previous versions didn't use a module for namespacing, however #timeout is
|
16
|
+
# provided for backwards compatibility. You should prefer Timeout.timeout
|
17
|
+
# instead.
|
18
|
+
#
|
19
|
+
# ## Copyright
|
20
|
+
#
|
21
|
+
# Copyright
|
22
|
+
# : (C) 2000 Network Applied Communication Laboratory, Inc.
|
23
|
+
# Copyright
|
24
|
+
# : (C) 2000 Information-technology Promotion Agency, Japan
|
25
|
+
#
|
26
|
+
module Timeout
|
27
|
+
# Perform an operation in a block, raising an error if it takes longer than
|
28
|
+
# `sec` seconds to complete.
|
29
|
+
#
|
30
|
+
# `sec`
|
31
|
+
# : Number of seconds to wait for the block to terminate. Any number may be
|
32
|
+
# used, including Floats to specify fractional seconds. A value of 0 or
|
33
|
+
# `nil` will execute the block without any timeout.
|
34
|
+
# `klass`
|
35
|
+
# : Exception Class to raise if the block fails to terminate in `sec` seconds.
|
36
|
+
# Omitting will use the default, Timeout::Error
|
37
|
+
# `message`
|
38
|
+
# : Error message to raise with Exception Class. Omitting will use the
|
39
|
+
# default, "execution expired"
|
40
|
+
#
|
41
|
+
#
|
42
|
+
# Returns the result of the block **if** the block completed before `sec`
|
43
|
+
# seconds, otherwise throws an exception, based on the value of `klass`.
|
44
|
+
#
|
45
|
+
# The exception thrown to terminate the given block cannot be rescued inside the
|
46
|
+
# block unless `klass` is given explicitly. However, the block can use ensure to
|
47
|
+
# prevent the handling of the exception. For that reason, this method cannot be
|
48
|
+
# relied on to enforce timeouts for untrusted blocks.
|
49
|
+
#
|
50
|
+
# Note that this is both a method of module Timeout, so you can `include
|
51
|
+
# Timeout` into your classes so they have a #timeout method, as well as a module
|
52
|
+
# method, so you can call it directly as Timeout.timeout().
|
53
|
+
#
|
54
|
+
def self?.timeout: [T] (Numeric? sec, ?singleton(Exception) klass, ?String message) { (Numeric sec) -> T } -> T
|
55
|
+
end
|
56
|
+
|
57
|
+
Timeout::VERSION: String
|
@@ -1,9 +1,146 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
#
|
4
|
-
|
5
|
-
end
|
1
|
+
module URI
|
2
|
+
# Includes URI::REGEXP::PATTERN
|
3
|
+
#
|
4
|
+
module RFC2396_REGEXP
|
5
|
+
end
|
6
|
+
|
7
|
+
# Class that parses String's into URI's.
|
8
|
+
#
|
9
|
+
# It contains a Hash set of patterns and Regexp's that match and validate.
|
10
|
+
#
|
11
|
+
class RFC2396_Parser
|
12
|
+
include RFC2396_REGEXP
|
13
|
+
|
14
|
+
# The Hash of patterns.
|
15
|
+
#
|
16
|
+
# See also URI::Parser.initialize_pattern.
|
17
|
+
#
|
18
|
+
attr_reader pattern: Hash[Symbol, String]
|
19
|
+
|
20
|
+
# The Hash of Regexp.
|
21
|
+
#
|
22
|
+
# See also URI::Parser.initialize_regexp.
|
23
|
+
#
|
24
|
+
attr_reader regexp: Hash[Symbol, Regexp]
|
25
|
+
|
26
|
+
# == Synopsis
|
27
|
+
#
|
28
|
+
# URI::Parser.new([opts])
|
29
|
+
#
|
30
|
+
# == Args
|
31
|
+
#
|
32
|
+
# The constructor accepts a hash as options for parser.
|
33
|
+
# Keys of options are pattern names of URI components
|
34
|
+
# and values of options are pattern strings.
|
35
|
+
# The constructor generates set of regexps for parsing URIs.
|
36
|
+
#
|
37
|
+
# You can use the following keys:
|
38
|
+
#
|
39
|
+
# * :ESCAPED (URI::PATTERN::ESCAPED in default)
|
40
|
+
# * :UNRESERVED (URI::PATTERN::UNRESERVED in default)
|
41
|
+
# * :DOMLABEL (URI::PATTERN::DOMLABEL in default)
|
42
|
+
# * :TOPLABEL (URI::PATTERN::TOPLABEL in default)
|
43
|
+
# * :HOSTNAME (URI::PATTERN::HOSTNAME in default)
|
44
|
+
#
|
45
|
+
# == Examples
|
46
|
+
#
|
47
|
+
# p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
|
48
|
+
# u = p.parse("http://example.jp/%uABCD") #=> #<URI::HTTP http://example.jp/%uABCD>
|
49
|
+
# URI.parse(u.to_s) #=> raises URI::InvalidURIError
|
50
|
+
#
|
51
|
+
# s = "http://example.com/ABCD"
|
52
|
+
# u1 = p.parse(s) #=> #<URI::HTTP http://example.com/ABCD>
|
53
|
+
# u2 = URI.parse(s) #=> #<URI::HTTP http://example.com/ABCD>
|
54
|
+
# u1 == u2 #=> true
|
55
|
+
# u1.eql?(u2) #=> false
|
56
|
+
#
|
57
|
+
def initialize: (?Hash[Symbol, String] opts) -> void
|
58
|
+
|
59
|
+
# ## Args
|
60
|
+
#
|
61
|
+
# `str`
|
62
|
+
# : String to make safe
|
63
|
+
# `unsafe`
|
64
|
+
# : Regexp to apply. Defaults to [self.regexp](:UNSAFE)
|
65
|
+
#
|
66
|
+
#
|
67
|
+
# ## Description
|
68
|
+
#
|
69
|
+
# Constructs a safe String from `str`, removing unsafe characters, replacing
|
70
|
+
# them with codes.
|
71
|
+
#
|
72
|
+
def escape: (String str, ?Regexp unsafe) -> String
|
73
|
+
|
74
|
+
# ## Args
|
75
|
+
#
|
76
|
+
# `str`
|
77
|
+
# : String to search
|
78
|
+
# `schemes`
|
79
|
+
# : Patterns to apply to `str`
|
80
|
+
#
|
81
|
+
#
|
82
|
+
# ## Description
|
83
|
+
#
|
84
|
+
# Attempts to parse and merge a set of URIs. If no `block` given, then returns
|
85
|
+
# the result, else it calls `block` for each element in result.
|
86
|
+
#
|
87
|
+
# See also URI::Parser.make_regexp.
|
88
|
+
#
|
89
|
+
def extract: (String str, ?Array[String] schemes) -> Array[String]
|
90
|
+
| (String str, ?Array[String] schemes) { (String) -> untyped } -> nil
|
91
|
+
|
92
|
+
# ## Args
|
93
|
+
#
|
94
|
+
# `uris`
|
95
|
+
# : an Array of Strings
|
96
|
+
#
|
97
|
+
#
|
98
|
+
# ## Description
|
99
|
+
#
|
100
|
+
# Attempts to parse and merge a set of URIs.
|
101
|
+
#
|
102
|
+
def join: (*String uris) -> URI::Generic
|
103
|
+
|
104
|
+
# Returns Regexp that is default [self.regexp](:ABS_URI_REF), unless `schemes`
|
105
|
+
# is provided. Then it is a Regexp.union with [self.pattern](:X_ABS_URI).
|
106
|
+
#
|
107
|
+
def make_regexp: (?Array[String] schemes) -> Regexp
|
108
|
+
|
109
|
+
# ## Args
|
110
|
+
#
|
111
|
+
# `uri`
|
112
|
+
# : String
|
113
|
+
#
|
114
|
+
#
|
115
|
+
# ## Description
|
116
|
+
#
|
117
|
+
# Parses `uri` and constructs either matching URI scheme object (File, FTP,
|
118
|
+
# HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic.
|
119
|
+
#
|
120
|
+
# ## Usage
|
121
|
+
#
|
122
|
+
# p = URI::Parser.new
|
123
|
+
# p.parse("ldap://ldap.example.com/dc=example?user=john")
|
124
|
+
# #=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>
|
125
|
+
#
|
126
|
+
def parse: (String uri) -> URI::Generic
|
127
|
+
|
128
|
+
# Returns a split URI against [regexp](:ABS_URI).
|
129
|
+
#
|
130
|
+
def split: (String uri) -> [ String?, String?, String?, String?, String?, String?, String?, String?, String? ]
|
6
131
|
|
7
|
-
#
|
8
|
-
|
132
|
+
# ## Args
|
133
|
+
#
|
134
|
+
# `str`
|
135
|
+
# : String to remove escapes from
|
136
|
+
# `escaped`
|
137
|
+
# : Regexp to apply. Defaults to [self.regexp](:ESCAPED)
|
138
|
+
#
|
139
|
+
#
|
140
|
+
# ## Description
|
141
|
+
#
|
142
|
+
# Removes escapes from `str`.
|
143
|
+
#
|
144
|
+
def unescape: (String str, ?Regexp escaped) -> String
|
145
|
+
end
|
9
146
|
end
|
data/steep/Gemfile.lock
CHANGED
@@ -1,42 +1,40 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (6.1.
|
4
|
+
activesupport (6.1.2.1)
|
5
5
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
6
|
i18n (>= 1.6, < 2)
|
7
7
|
minitest (>= 5.1)
|
8
8
|
tzinfo (~> 2.0)
|
9
9
|
zeitwerk (~> 2.3)
|
10
|
-
ast (2.4.
|
11
|
-
ast_utils (0.
|
12
|
-
parser (
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
i18n (1.8.5)
|
10
|
+
ast (2.4.2)
|
11
|
+
ast_utils (0.4.0)
|
12
|
+
parser (>= 2.7.0)
|
13
|
+
concurrent-ruby (1.1.8)
|
14
|
+
ffi (1.14.2)
|
15
|
+
i18n (1.8.8)
|
17
16
|
concurrent-ruby (~> 1.0)
|
18
17
|
language_server-protocol (3.15.0.1)
|
19
|
-
listen (3.
|
18
|
+
listen (3.4.1)
|
20
19
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
21
20
|
rb-inotify (~> 0.9, >= 0.9.10)
|
22
|
-
minitest (5.14.
|
23
|
-
parser (
|
21
|
+
minitest (5.14.3)
|
22
|
+
parser (3.0.0.0)
|
24
23
|
ast (~> 2.4.1)
|
25
24
|
rainbow (3.0.0)
|
26
25
|
rb-fsevent (0.10.4)
|
27
26
|
rb-inotify (0.10.1)
|
28
27
|
ffi (~> 1.0)
|
29
|
-
rbs (0.
|
30
|
-
steep (0.
|
28
|
+
rbs (1.0.4)
|
29
|
+
steep (0.41.0)
|
31
30
|
activesupport (>= 5.1)
|
32
|
-
ast_utils (
|
31
|
+
ast_utils (>= 0.4.0)
|
33
32
|
language_server-protocol (~> 3.15.0.1)
|
34
33
|
listen (~> 3.0)
|
35
|
-
parser (
|
34
|
+
parser (>= 2.7)
|
36
35
|
rainbow (>= 2.2.2, < 4.0)
|
37
|
-
rbs (
|
38
|
-
|
39
|
-
tzinfo (2.0.3)
|
36
|
+
rbs (~> 1.0.3)
|
37
|
+
tzinfo (2.0.4)
|
40
38
|
concurrent-ruby (~> 1.0)
|
41
39
|
zeitwerk (2.4.2)
|
42
40
|
|
@@ -47,4 +45,4 @@ DEPENDENCIES
|
|
47
45
|
steep
|
48
46
|
|
49
47
|
BUNDLED WITH
|
50
|
-
2.2.
|
48
|
+
2.2.3
|
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: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-02-12 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.
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- stdlib/set/0/set.rbs
|
225
225
|
- stdlib/singleton/0/singleton.rbs
|
226
226
|
- stdlib/time/0/time.rbs
|
227
|
+
- stdlib/timeout/0/timeout.rbs
|
227
228
|
- stdlib/tmpdir/0/tmpdir.rbs
|
228
229
|
- stdlib/tsort/0/cyclic.rbs
|
229
230
|
- stdlib/tsort/0/interfaces.rbs
|