rbs 3.6.0.dev.1 → 3.6.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +28 -1
- data/CHANGELOG.md +76 -0
- data/Rakefile +8 -2
- data/core/basic_object.rbs +1 -1
- data/core/builtin.rbs +4 -4
- data/core/dir.rbs +1 -1
- data/core/enumerable.rbs +12 -12
- data/core/enumerator/product.rbs +1 -1
- data/core/enumerator.rbs +3 -3
- data/core/errors.rbs +1 -1
- data/core/exception.rbs +1 -1
- data/core/file.rbs +1 -1
- data/core/integer.rbs +4 -4
- data/core/kernel.rbs +2 -2
- data/core/module.rbs +1 -1
- data/core/random.rbs +1 -1
- data/core/rbs/unnamed/env_class.rbs +7 -7
- data/core/rbs/unnamed/random.rbs +14 -14
- data/core/regexp.rbs +2 -2
- data/core/thread.rbs +6 -5
- data/docs/syntax.md +5 -3
- data/ext/rbs_extension/lexer.c +1 -1
- data/ext/rbs_extension/lexer.h +5 -0
- data/ext/rbs_extension/lexer.re +1 -1
- data/ext/rbs_extension/lexstate.c +16 -0
- data/ext/rbs_extension/location.c +27 -39
- data/ext/rbs_extension/location.h +7 -2
- data/ext/rbs_extension/parser.c +1 -1
- data/lib/rbs/buffer.rb +5 -0
- data/lib/rbs/cli/validate.rb +41 -1
- data/lib/rbs/errors.rb +1 -1
- data/lib/rbs/location_aux.rb +2 -6
- data/lib/rbs/test/type_check.rb +7 -0
- data/lib/rbs/version.rb +1 -1
- data/sig/location.rbs +0 -3
- data/stdlib/csv/0/csv.rbs +17 -6
- data/stdlib/digest/0/digest.rbs +22 -28
- data/stdlib/ipaddr/0/ipaddr.rbs +1 -1
- data/stdlib/kconv/0/kconv.rbs +166 -0
- data/stdlib/net-http/0/net-http.rbs +1 -1
- data/stdlib/psych/0/store.rbs +1 -1
- data/stdlib/uri/0/ldap.rbs +1 -1
- data/stdlib/zlib/0/deflate.rbs +1 -1
- metadata +3 -2
@@ -3,7 +3,9 @@
|
|
3
3
|
#define RBS_LOC_REQUIRED_P(loc, i) ((loc)->children->required_p & (1 << (i)))
|
4
4
|
#define RBS_LOC_OPTIONAL_P(loc, i) (!RBS_LOC_REQUIRED_P((loc), (i)))
|
5
5
|
#define RBS_LOC_CHILDREN_SIZE(cap) (sizeof(rbs_loc_children) + sizeof(rbs_loc_entry) * ((cap) - 1))
|
6
|
+
#define NULL_LOC_RANGE_P(rg) ((rg).start == -1)
|
6
7
|
|
8
|
+
rbs_loc_range RBS_LOC_NULL_RANGE = { -1, -1 };
|
7
9
|
VALUE RBS_Location;
|
8
10
|
|
9
11
|
position rbs_loc_position(int char_pos) {
|
@@ -16,6 +18,11 @@ position rbs_loc_position3(int char_pos, int line, int column) {
|
|
16
18
|
return pos;
|
17
19
|
}
|
18
20
|
|
21
|
+
rbs_loc_range rbs_new_loc_range(range rg) {
|
22
|
+
rbs_loc_range r = { rg.start.char_pos, rg.end.char_pos };
|
23
|
+
return r;
|
24
|
+
}
|
25
|
+
|
19
26
|
static void check_children_max(unsigned short n) {
|
20
27
|
size_t max = sizeof(rbs_loc_entry_bitmap) * 8;
|
21
28
|
if (n > max) {
|
@@ -51,7 +58,7 @@ void rbs_loc_add_required_child(rbs_loc *loc, ID name, range r) {
|
|
51
58
|
|
52
59
|
unsigned short i = loc->children->len++;
|
53
60
|
loc->children->entries[i].name = name;
|
54
|
-
loc->children->entries[i].rg = r;
|
61
|
+
loc->children->entries[i].rg = rbs_new_loc_range(r);
|
55
62
|
|
56
63
|
loc->children->required_p |= 1 << i;
|
57
64
|
}
|
@@ -61,10 +68,10 @@ void rbs_loc_add_optional_child(rbs_loc *loc, ID name, range r) {
|
|
61
68
|
|
62
69
|
unsigned short i = loc->children->len++;
|
63
70
|
loc->children->entries[i].name = name;
|
64
|
-
loc->children->entries[i].rg = r;
|
71
|
+
loc->children->entries[i].rg = rbs_new_loc_range(r);
|
65
72
|
}
|
66
73
|
|
67
|
-
void rbs_loc_init(rbs_loc *loc, VALUE buffer,
|
74
|
+
void rbs_loc_init(rbs_loc *loc, VALUE buffer, rbs_loc_range rg) {
|
68
75
|
loc->buffer = buffer;
|
69
76
|
loc->rg = rg;
|
70
77
|
loc->children = NULL;
|
@@ -100,7 +107,7 @@ static VALUE location_s_allocate(VALUE klass) {
|
|
100
107
|
rbs_loc *loc;
|
101
108
|
VALUE obj = TypedData_Make_Struct(klass, rbs_loc, &location_type, loc);
|
102
109
|
|
103
|
-
rbs_loc_init(loc, Qnil,
|
110
|
+
rbs_loc_init(loc, Qnil, RBS_LOC_NULL_RANGE);
|
104
111
|
|
105
112
|
return obj;
|
106
113
|
}
|
@@ -112,8 +119,8 @@ rbs_loc *rbs_check_location(VALUE obj) {
|
|
112
119
|
static VALUE location_initialize(VALUE self, VALUE buffer, VALUE start_pos, VALUE end_pos) {
|
113
120
|
rbs_loc *loc = rbs_check_location(self);
|
114
121
|
|
115
|
-
|
116
|
-
|
122
|
+
int start = FIX2INT(start_pos);
|
123
|
+
int end = FIX2INT(end_pos);
|
117
124
|
|
118
125
|
loc->buffer = buffer;
|
119
126
|
loc->rg.start = start;
|
@@ -143,38 +150,12 @@ static VALUE location_buffer(VALUE self) {
|
|
143
150
|
|
144
151
|
static VALUE location_start_pos(VALUE self) {
|
145
152
|
rbs_loc *loc = rbs_check_location(self);
|
146
|
-
return INT2FIX(loc->rg.start
|
153
|
+
return INT2FIX(loc->rg.start);
|
147
154
|
}
|
148
155
|
|
149
156
|
static VALUE location_end_pos(VALUE self) {
|
150
157
|
rbs_loc *loc = rbs_check_location(self);
|
151
|
-
return INT2FIX(loc->rg.end
|
152
|
-
}
|
153
|
-
|
154
|
-
static VALUE location_start_loc(VALUE self) {
|
155
|
-
rbs_loc *loc = rbs_check_location(self);
|
156
|
-
|
157
|
-
if (loc->rg.start.line >= 0) {
|
158
|
-
VALUE pair = rb_ary_new_capa(2);
|
159
|
-
rb_ary_push(pair, INT2FIX(loc->rg.start.line));
|
160
|
-
rb_ary_push(pair, INT2FIX(loc->rg.start.column));
|
161
|
-
return pair;
|
162
|
-
} else {
|
163
|
-
return Qnil;
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
static VALUE location_end_loc(VALUE self) {
|
168
|
-
rbs_loc *loc = rbs_check_location(self);
|
169
|
-
|
170
|
-
if (loc->rg.end.line >= 0) {
|
171
|
-
VALUE pair = rb_ary_new_capa(2);
|
172
|
-
rb_ary_push(pair, INT2FIX(loc->rg.end.line));
|
173
|
-
rb_ary_push(pair, INT2FIX(loc->rg.end.column));
|
174
|
-
return pair;
|
175
|
-
} else {
|
176
|
-
return Qnil;
|
177
|
-
}
|
158
|
+
return INT2FIX(loc->rg.end);
|
178
159
|
}
|
179
160
|
|
180
161
|
static VALUE location_add_required_child(VALUE self, VALUE name, VALUE start, VALUE end) {
|
@@ -213,6 +194,15 @@ VALUE rbs_new_location(VALUE buffer, range rg) {
|
|
213
194
|
rbs_loc *loc;
|
214
195
|
VALUE obj = TypedData_Make_Struct(RBS_Location, rbs_loc, &location_type, loc);
|
215
196
|
|
197
|
+
rbs_loc_init(loc, buffer, rbs_new_loc_range(rg));
|
198
|
+
|
199
|
+
return obj;
|
200
|
+
}
|
201
|
+
|
202
|
+
static VALUE rbs_new_location_from_loc_range(VALUE buffer, rbs_loc_range rg) {
|
203
|
+
rbs_loc *loc;
|
204
|
+
VALUE obj = TypedData_Make_Struct(RBS_Location, rbs_loc, &location_type, loc);
|
205
|
+
|
216
206
|
rbs_loc_init(loc, buffer, rg);
|
217
207
|
|
218
208
|
return obj;
|
@@ -226,12 +216,12 @@ static VALUE location_aref(VALUE self, VALUE name) {
|
|
226
216
|
if (loc->children != NULL) {
|
227
217
|
for (unsigned short i = 0; i < loc->children->len; i++) {
|
228
218
|
if (loc->children->entries[i].name == id) {
|
229
|
-
|
219
|
+
rbs_loc_range result = loc->children->entries[i].rg;
|
230
220
|
|
231
|
-
if (RBS_LOC_OPTIONAL_P(loc, i) &&
|
221
|
+
if (RBS_LOC_OPTIONAL_P(loc, i) && NULL_LOC_RANGE_P(result)) {
|
232
222
|
return Qnil;
|
233
223
|
} else {
|
234
|
-
return
|
224
|
+
return rbs_new_location_from_loc_range(loc->buffer, result);
|
235
225
|
}
|
236
226
|
}
|
237
227
|
}
|
@@ -294,8 +284,6 @@ void rbs__init_location(void) {
|
|
294
284
|
rb_define_method(RBS_Location, "buffer", location_buffer, 0);
|
295
285
|
rb_define_method(RBS_Location, "start_pos", location_start_pos, 0);
|
296
286
|
rb_define_method(RBS_Location, "end_pos", location_end_pos, 0);
|
297
|
-
rb_define_private_method(RBS_Location, "_start_loc", location_start_loc, 0);
|
298
|
-
rb_define_private_method(RBS_Location, "_end_loc", location_end_loc, 0);
|
299
287
|
rb_define_method(RBS_Location, "_add_required_child", location_add_required_child, 3);
|
300
288
|
rb_define_method(RBS_Location, "_add_optional_child", location_add_optional_child, 3);
|
301
289
|
rb_define_method(RBS_Location, "_add_optional_no_child", location_add_optional_no_child, 1);
|
@@ -9,9 +9,14 @@
|
|
9
9
|
* */
|
10
10
|
extern VALUE RBS_Location;
|
11
11
|
|
12
|
+
typedef struct {
|
13
|
+
int start;
|
14
|
+
int end;
|
15
|
+
} rbs_loc_range;
|
16
|
+
|
12
17
|
typedef struct {
|
13
18
|
ID name;
|
14
|
-
|
19
|
+
rbs_loc_range rg;
|
15
20
|
} rbs_loc_entry;
|
16
21
|
|
17
22
|
typedef unsigned int rbs_loc_entry_bitmap;
|
@@ -27,7 +32,7 @@ typedef struct {
|
|
27
32
|
|
28
33
|
typedef struct {
|
29
34
|
VALUE buffer;
|
30
|
-
|
35
|
+
rbs_loc_range rg;
|
31
36
|
rbs_loc_children *children; // NULL when no children is allocated
|
32
37
|
} rbs_loc;
|
33
38
|
|
data/ext/rbs_extension/parser.c
CHANGED
@@ -1194,7 +1194,7 @@ VALUE parse_type_params(parserstate *state, range *rg, bool module_type_params)
|
|
1194
1194
|
|
1195
1195
|
default_type_range.start = state->current_token.range.start;
|
1196
1196
|
default_type = parse_type(state);
|
1197
|
-
default_type_range.
|
1197
|
+
default_type_range.end = state->current_token.range.end;
|
1198
1198
|
|
1199
1199
|
required_param_allowed = false;
|
1200
1200
|
} else {
|
data/lib/rbs/buffer.rb
CHANGED
data/lib/rbs/cli/validate.rb
CHANGED
@@ -164,7 +164,7 @@ EOU
|
|
164
164
|
end
|
165
165
|
|
166
166
|
if dt = param.default_type
|
167
|
-
void_type_context_validator(dt)
|
167
|
+
void_type_context_validator(dt, true)
|
168
168
|
no_self_type_validator(dt)
|
169
169
|
no_classish_type_validator(dt)
|
170
170
|
@validator.validate_type(dt, context: nil)
|
@@ -232,6 +232,22 @@ EOU
|
|
232
232
|
location: decl.decl.location&.aref(:type_params)
|
233
233
|
)
|
234
234
|
|
235
|
+
decl.decl.type_params.each do |param|
|
236
|
+
if ub = param.upper_bound_type
|
237
|
+
void_type_context_validator(ub)
|
238
|
+
no_self_type_validator(ub)
|
239
|
+
no_classish_type_validator(ub)
|
240
|
+
@validator.validate_type(ub, context: nil)
|
241
|
+
end
|
242
|
+
|
243
|
+
if dt = param.default_type
|
244
|
+
void_type_context_validator(dt, true)
|
245
|
+
no_self_type_validator(dt)
|
246
|
+
no_classish_type_validator(dt)
|
247
|
+
@validator.validate_type(dt, context: nil)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
235
251
|
decl.decl.members.each do |member|
|
236
252
|
case member
|
237
253
|
when AST::Members::MethodDefinition
|
@@ -278,7 +294,31 @@ EOU
|
|
278
294
|
@builder.expand_alias1(name).tap do |type|
|
279
295
|
@validator.validate_type type, context: nil
|
280
296
|
end
|
297
|
+
|
281
298
|
@validator.validate_type_alias(entry: decl)
|
299
|
+
|
300
|
+
@validator.validate_type_params(
|
301
|
+
decl.decl.type_params,
|
302
|
+
type_name: name,
|
303
|
+
location: decl.decl.location&.aref(:type_params)
|
304
|
+
)
|
305
|
+
|
306
|
+
decl.decl.type_params.each do |param|
|
307
|
+
if ub = param.upper_bound_type
|
308
|
+
void_type_context_validator(ub)
|
309
|
+
no_self_type_validator(ub)
|
310
|
+
no_classish_type_validator(ub)
|
311
|
+
@validator.validate_type(ub, context: nil)
|
312
|
+
end
|
313
|
+
|
314
|
+
if dt = param.default_type
|
315
|
+
void_type_context_validator(dt, true)
|
316
|
+
no_self_type_validator(dt)
|
317
|
+
no_classish_type_validator(dt)
|
318
|
+
@validator.validate_type(dt, context: nil)
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
282
322
|
no_self_type_validator(decl.decl.type)
|
283
323
|
no_classish_type_validator(decl.decl.type)
|
284
324
|
void_type_context_validator(decl.decl.type)
|
data/lib/rbs/errors.rb
CHANGED
@@ -35,7 +35,7 @@ module RBS
|
|
35
35
|
return msg unless location.start_line == location.end_line
|
36
36
|
|
37
37
|
indent = " " * location.start_column
|
38
|
-
marker = "^" * (location.end_column - location.start_column)
|
38
|
+
marker = "^" * ([location.end_column - location.start_column, 1].max or raise)
|
39
39
|
|
40
40
|
io = StringIO.new
|
41
41
|
io.puts msg
|
data/lib/rbs/location_aux.rb
CHANGED
@@ -49,15 +49,11 @@ module RBS
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def start_loc
|
52
|
-
@start_loc ||=
|
53
|
-
_start_loc || buffer.pos_to_loc(start_pos)
|
54
|
-
end
|
52
|
+
@start_loc ||= buffer.pos_to_loc(start_pos)
|
55
53
|
end
|
56
54
|
|
57
55
|
def end_loc
|
58
|
-
@end_loc ||=
|
59
|
-
_end_loc || buffer.pos_to_loc(end_pos)
|
60
|
-
end
|
56
|
+
@end_loc ||= buffer.pos_to_loc(end_pos)
|
61
57
|
end
|
62
58
|
|
63
59
|
def range
|
data/lib/rbs/test/type_check.rb
CHANGED
@@ -260,6 +260,13 @@ module RBS
|
|
260
260
|
Test.call(val, IS_AP, instance_class)
|
261
261
|
when Types::ClassInstance
|
262
262
|
klass = get_class(type.name) or return false
|
263
|
+
if params = builder.env.normalized_module_class_entry(type.name.absolute!)&.type_params
|
264
|
+
args = AST::TypeParam.normalize_args(params, type.args)
|
265
|
+
unless args == type.args
|
266
|
+
type = Types::ClassInstance.new(name: type.name, args: args, location: type.location)
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
263
270
|
case
|
264
271
|
when klass == ::Array
|
265
272
|
Test.call(val, IS_AP, klass) && each_sample(val).all? {|v| value(v, type.args[0]) }
|
data/lib/rbs/version.rb
CHANGED
data/sig/location.rbs
CHANGED
@@ -99,9 +99,6 @@ module RBS
|
|
99
99
|
|
100
100
|
private
|
101
101
|
|
102
|
-
def _start_loc: () -> Buffer::loc?
|
103
|
-
def _end_loc: () -> Buffer::loc?
|
104
|
-
|
105
102
|
def _add_required_child: (RequiredChildKeys name, Integer start_pos, Integer end_pos) -> void
|
106
103
|
def _add_optional_child: (OptionalChildKeys name, Integer start_pos, Integer end_pos) -> void
|
107
104
|
def _add_optional_no_child: (OptionalChildKeys name) -> void
|
data/stdlib/csv/0/csv.rbs
CHANGED
@@ -1722,8 +1722,8 @@ class CSV < Object
|
|
1722
1722
|
# would read `UTF-32BE` data from the file but transcode it to `UTF-8`
|
1723
1723
|
# before parsing.
|
1724
1724
|
#
|
1725
|
-
def self.foreach: (String | IO path, ?String mode, headers: true, **untyped options) { (::CSV::Row arg0) -> void } -> void
|
1726
|
-
| (String | IO path, ?String mode, headers: true, **untyped options) -> Enumerator[::CSV::Row, void]
|
1725
|
+
def self.foreach: (String | IO path, ?String mode, headers: true | :first_row | Array[untyped] | String, **untyped options) { (::CSV::Row arg0) -> void } -> void
|
1726
|
+
| (String | IO path, ?String mode, headers: true | :first_row | Array[untyped] | String, **untyped options) -> Enumerator[::CSV::Row, void]
|
1727
1727
|
| (String | IO path, ?String mode, **untyped options) { (::Array[String?] arg0) -> void } -> void
|
1728
1728
|
| (String | IO path, ?String mode, **untyped options) -> Enumerator[::Array[String?], void]
|
1729
1729
|
|
@@ -2031,7 +2031,8 @@ class CSV < Object
|
|
2031
2031
|
# File.write(path, string)
|
2032
2032
|
# CSV.read(path, headers: true) # => #<CSV::Table mode:col_or_row row_count:4>
|
2033
2033
|
#
|
2034
|
-
def self.read: (String path,
|
2034
|
+
def self.read: (String | IO path, headers: true | :first_row | Array[untyped] | String, **untyped options) -> ::CSV::Table[CSV::Row]
|
2035
|
+
| (String | IO path, ?::Hash[Symbol, untyped] options) -> ::Array[::Array[String?]]
|
2035
2036
|
|
2036
2037
|
# <!--
|
2037
2038
|
# rdoc-file=lib/csv.rb
|
@@ -2195,6 +2196,16 @@ class CSV < Object
|
|
2195
2196
|
#
|
2196
2197
|
def each: () -> Enumerator[untyped, Integer]
|
2197
2198
|
| () { (untyped) -> void } -> Integer
|
2199
|
+
|
2200
|
+
# <!--
|
2201
|
+
# rdoc-file=lib/csv.rb
|
2202
|
+
# - csv.headers -> object
|
2203
|
+
# -->
|
2204
|
+
# Returns the value that determines whether headers are used; used for parsing;
|
2205
|
+
# see {Option `headers`[}](#class-CSV-label-Option+headers):
|
2206
|
+
# CSV.new('').headers # => nil
|
2207
|
+
#
|
2208
|
+
def headers: () -> (Array[String] | true | nil)
|
2198
2209
|
end
|
2199
2210
|
|
2200
2211
|
# <!-- rdoc-file=lib/csv.rb -->
|
@@ -3002,7 +3013,7 @@ end
|
|
3002
3013
|
# table['Name'] # => ["Foo", "Bar", "Baz"]
|
3003
3014
|
#
|
3004
3015
|
class CSV::Table[out Elem] < Object
|
3005
|
-
include Enumerable[
|
3016
|
+
include Enumerable[Elem]
|
3006
3017
|
extend Forwardable
|
3007
3018
|
|
3008
3019
|
# <!--
|
@@ -3633,8 +3644,8 @@ class CSV::Table[out Elem] < Object
|
|
3633
3644
|
# Returns a new Enumerator if no block is given:
|
3634
3645
|
# table.each # => #<Enumerator: #<CSV::Table mode:col row_count:4>:each>
|
3635
3646
|
#
|
3636
|
-
def each: () -> Enumerator[
|
3637
|
-
| () { (
|
3647
|
+
def each: () -> Enumerator[Elem, self]
|
3648
|
+
| () { (Elem) -> void } -> self
|
3638
3649
|
| () { (*untyped) -> void } -> self
|
3639
3650
|
|
3640
3651
|
def empty?: (*untyped args) { (*untyped) -> untyped } -> untyped
|
data/stdlib/digest/0/digest.rbs
CHANGED
@@ -74,7 +74,7 @@ module Digest
|
|
74
74
|
# -->
|
75
75
|
# Returns a BubbleBabble encoded version of a given *string*.
|
76
76
|
#
|
77
|
-
def self.bubblebabble: (
|
77
|
+
def self.bubblebabble: (string) -> String
|
78
78
|
|
79
79
|
def self.const_missing: (Symbol name) -> singleton(::Digest::Base)
|
80
80
|
|
@@ -84,13 +84,13 @@ module Digest
|
|
84
84
|
# -->
|
85
85
|
# Generates a hex-encoded version of a given *string*.
|
86
86
|
#
|
87
|
-
def self.hexencode: (
|
87
|
+
def self.hexencode: (string) -> String
|
88
88
|
|
89
89
|
private
|
90
90
|
|
91
|
-
def bubblebabble: (
|
91
|
+
def bubblebabble: (string) -> String
|
92
92
|
|
93
|
-
def hexencode: (
|
93
|
+
def hexencode: (string) -> String
|
94
94
|
end
|
95
95
|
|
96
96
|
# <!-- rdoc-file=ext/digest/lib/digest.rb -->
|
@@ -111,7 +111,7 @@ module Digest::Instance
|
|
111
111
|
# The update() method and the left-shift operator are overridden by each
|
112
112
|
# implementation subclass. (One should be an alias for the other)
|
113
113
|
#
|
114
|
-
def <<: (
|
114
|
+
def <<: (string) -> self
|
115
115
|
|
116
116
|
# <!--
|
117
117
|
# rdoc-file=ext/digest/digest.c
|
@@ -122,7 +122,7 @@ module Digest::Instance
|
|
122
122
|
# of the digest object. If another digest instance is given, checks whether
|
123
123
|
# they have the same hash value. Otherwise returns false.
|
124
124
|
#
|
125
|
-
def ==: (
|
125
|
+
def ==: (instance | string) -> bool
|
126
126
|
|
127
127
|
# <!--
|
128
128
|
# rdoc-file=ext/digest/lib/digest.rb
|
@@ -138,7 +138,7 @@ module Digest::Instance
|
|
138
138
|
# In either case, the return value is properly padded with '=' and contains no
|
139
139
|
# line feeds.
|
140
140
|
#
|
141
|
-
def base64digest: (?
|
141
|
+
def base64digest: (?string? str) -> String
|
142
142
|
|
143
143
|
# <!--
|
144
144
|
# rdoc-file=ext/digest/lib/digest.rb
|
@@ -177,7 +177,7 @@ module Digest::Instance
|
|
177
177
|
# If a *string* is given, returns the hash value for the given *string*,
|
178
178
|
# resetting the digest to the initial state before and after the process.
|
179
179
|
#
|
180
|
-
def digest: (?
|
180
|
+
def digest: (?string) -> String
|
181
181
|
|
182
182
|
# <!--
|
183
183
|
# rdoc-file=ext/digest/digest.c
|
@@ -204,7 +204,7 @@ module Digest::Instance
|
|
204
204
|
# -->
|
205
205
|
# Updates the digest with the contents of a given file *name* and returns self.
|
206
206
|
#
|
207
|
-
def file: (
|
207
|
+
def file: (string name) -> instance
|
208
208
|
|
209
209
|
# <!--
|
210
210
|
# rdoc-file=ext/digest/digest.c
|
@@ -218,7 +218,7 @@ module Digest::Instance
|
|
218
218
|
# hex-encoded form, resetting the digest to the initial state before and after
|
219
219
|
# the process.
|
220
220
|
#
|
221
|
-
def hexdigest: (?
|
221
|
+
def hexdigest: (?string) -> String
|
222
222
|
|
223
223
|
# <!--
|
224
224
|
# rdoc-file=ext/digest/digest.c
|
@@ -253,7 +253,7 @@ module Digest::Instance
|
|
253
253
|
# Returns a new, initialized copy of the digest object. Equivalent to
|
254
254
|
# digest_obj.clone().reset().
|
255
255
|
#
|
256
|
-
def new: () ->
|
256
|
+
def new: () -> instance
|
257
257
|
|
258
258
|
# <!--
|
259
259
|
# rdoc-file=ext/digest/digest.c
|
@@ -288,7 +288,7 @@ module Digest::Instance
|
|
288
288
|
# The update() method and the left-shift operator are overridden by each
|
289
289
|
# implementation subclass. (One should be an alias for the other)
|
290
290
|
#
|
291
|
-
def update: (
|
291
|
+
def update: (string) -> self
|
292
292
|
|
293
293
|
private
|
294
294
|
|
@@ -319,7 +319,7 @@ class Digest::Class
|
|
319
319
|
# Returns the base64 encoded hash value of a given *string*. The return value
|
320
320
|
# is properly padded with '=' and contains no line feeds.
|
321
321
|
#
|
322
|
-
def self.base64digest: (
|
322
|
+
def self.base64digest: (string str) -> String
|
323
323
|
|
324
324
|
# <!--
|
325
325
|
# rdoc-file=ext/digest/bubblebabble/bubblebabble.c
|
@@ -327,7 +327,7 @@ class Digest::Class
|
|
327
327
|
# -->
|
328
328
|
# Returns the BubbleBabble encoded hash value of a given *string*.
|
329
329
|
#
|
330
|
-
def self.bubblebabble: (
|
330
|
+
def self.bubblebabble: (string) -> String
|
331
331
|
|
332
332
|
# <!--
|
333
333
|
# rdoc-file=ext/digest/digest.c
|
@@ -338,7 +338,7 @@ class Digest::Class
|
|
338
338
|
# any, are passed through to the constructor and the *string* is passed to
|
339
339
|
# #digest().
|
340
340
|
#
|
341
|
-
def self.digest: (
|
341
|
+
def self.digest: (string) -> String
|
342
342
|
|
343
343
|
# <!--
|
344
344
|
# rdoc-file=ext/digest/lib/digest.rb
|
@@ -350,7 +350,7 @@ class Digest::Class
|
|
350
350
|
# p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
|
351
351
|
# # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
|
352
352
|
#
|
353
|
-
def self.file: (
|
353
|
+
def self.file: (string name) -> instance
|
354
354
|
|
355
355
|
# <!--
|
356
356
|
# rdoc-file=ext/digest/digest.c
|
@@ -359,11 +359,11 @@ class Digest::Class
|
|
359
359
|
# Returns the hex-encoded hash value of a given *string*. This is almost
|
360
360
|
# equivalent to Digest.hexencode(Digest::Class.new(*parameters).digest(string)).
|
361
361
|
#
|
362
|
-
def self.hexdigest: (
|
362
|
+
def self.hexdigest: (string) -> String
|
363
363
|
|
364
364
|
private
|
365
365
|
|
366
|
-
def initialize: () ->
|
366
|
+
def initialize: () -> void
|
367
367
|
end
|
368
368
|
|
369
369
|
# <!-- rdoc-file=ext/digest/digest.c -->
|
@@ -408,7 +408,7 @@ class Digest::Base < Digest::Class
|
|
408
408
|
# <!-- rdoc-file=ext/digest/digest.c -->
|
409
409
|
# Update the digest using given *string* and return `self`.
|
410
410
|
#
|
411
|
-
def <<: (
|
411
|
+
def <<: (string) -> self
|
412
412
|
|
413
413
|
# <!--
|
414
414
|
# rdoc-file=ext/digest/digest.c
|
@@ -434,20 +434,14 @@ class Digest::Base < Digest::Class
|
|
434
434
|
#
|
435
435
|
def reset: () -> self
|
436
436
|
|
437
|
-
|
438
|
-
|
439
|
-
# - digest_base.update(string) -> digest_base
|
440
|
-
# - digest_base << string -> digest_base
|
441
|
-
# -->
|
442
|
-
# Update the digest using given *string* and return `self`.
|
443
|
-
#
|
444
|
-
def update: (String) -> self
|
437
|
+
%a{annotate:rdoc:skip}
|
438
|
+
alias update <<
|
445
439
|
|
446
440
|
private
|
447
441
|
|
448
442
|
def finish: () -> String
|
449
443
|
|
450
|
-
def initialize_copy: (
|
444
|
+
def initialize_copy: (self) -> self
|
451
445
|
end
|
452
446
|
|
453
447
|
# <!-- rdoc-file=ext/digest/sha1/sha1init.c -->
|
data/stdlib/ipaddr/0/ipaddr.rbs
CHANGED
@@ -63,7 +63,7 @@ class IPAddr
|
|
63
63
|
# as &, |, include? and ==, accept a string, or a packed in_addr value instead
|
64
64
|
# of an IPAddr object.
|
65
65
|
#
|
66
|
-
def initialize: (?String addr, ?untyped family) ->
|
66
|
+
def initialize: (?String addr, ?untyped family) -> void
|
67
67
|
|
68
68
|
# <!--
|
69
69
|
# rdoc-file=lib/ipaddr.rb
|