rbs 0.14.0 → 0.15.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 +11 -0
- data/docs/syntax.md +50 -6
- data/lib/rbs/definition_builder.rb +2 -2
- data/lib/rbs/parser.rb +98 -96
- data/lib/rbs/parser.y +3 -1
- 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/tester.rb +4 -1
- data/lib/rbs/test/type_check.rb +10 -4
- data/lib/rbs/version.rb +1 -1
- data/sig/constant_table.rbs +1 -1
- data/sig/declarations.rbs +1 -1
- data/sig/definition.rbs +1 -1
- data/sig/environment_loader.rbs +3 -3
- data/sig/members.rbs +2 -2
- data/sig/method_types.rbs +1 -1
- data/sig/namespace.rbs +1 -1
- data/stdlib/base64/base64.rbs +1 -1
- data/stdlib/builtin/array.rbs +124 -120
- data/stdlib/builtin/builtin.rbs +28 -0
- data/stdlib/builtin/enumerable.rbs +26 -20
- data/stdlib/builtin/errors.rbs +1 -1
- data/stdlib/builtin/gc.rbs +2 -2
- data/stdlib/builtin/hash.rbs +7 -7
- data/stdlib/builtin/io.rbs +5 -5
- data/stdlib/builtin/kernel.rbs +1 -85
- data/stdlib/builtin/module.rbs +13 -13
- data/stdlib/builtin/object.rbs +1 -1
- data/stdlib/builtin/random.rbs +1 -1
- data/stdlib/builtin/range.rbs +2 -2
- data/stdlib/builtin/string.rbs +6 -6
- data/stdlib/builtin/string_io.rbs +7 -7
- data/stdlib/builtin/struct.rbs +1 -1
- data/stdlib/builtin/symbol.rbs +1 -1
- data/stdlib/builtin/thread.rbs +4 -4
- data/stdlib/builtin/true_class.rbs +1 -1
- data/stdlib/coverage/coverage.rbs +2 -2
- data/stdlib/csv/csv.rbs +1 -1
- data/stdlib/date/date.rbs +2 -2
- data/stdlib/date/date_time.rbs +1 -1
- data/stdlib/find/find.rbs +2 -2
- data/stdlib/logger/log_device.rbs +1 -1
- data/stdlib/logger/logger.rbs +1 -1
- data/stdlib/pathname/pathname.rbs +39 -39
- data/stdlib/pstore/pstore.rbs +287 -0
- data/stdlib/pty/pty.rbs +1 -1
- data/stdlib/uri/generic.rbs +1 -1
- metadata +3 -2
data/stdlib/builtin/builtin.rbs
CHANGED
@@ -30,6 +30,25 @@ interface _Each[out A, out B]
|
|
30
30
|
def each: { (A) -> void } -> B
|
31
31
|
end
|
32
32
|
|
33
|
+
interface _Reader
|
34
|
+
def read: (?int length, ?string outbuf) -> String?
|
35
|
+
end
|
36
|
+
|
37
|
+
interface _Writer
|
38
|
+
# Writes the +data+ string. Returns the number of bytes written
|
39
|
+
def write: (*_ToS data) -> Integer
|
40
|
+
end
|
41
|
+
|
42
|
+
interface _Rewindable
|
43
|
+
# Positions the stream to the beginning of input, resetting `lineno` to zero.
|
44
|
+
#
|
45
|
+
def rewind: () -> Integer
|
46
|
+
end
|
47
|
+
|
48
|
+
interface _ToIO
|
49
|
+
def to_io: () -> IO
|
50
|
+
end
|
51
|
+
|
33
52
|
interface _Exception
|
34
53
|
def exception: () -> Exception
|
35
54
|
| (String arg0) -> Exception
|
@@ -40,3 +59,12 @@ type real = Integer | Float | Rational
|
|
40
59
|
|
41
60
|
type string = String | _ToStr
|
42
61
|
type encoding = Encoding | string
|
62
|
+
|
63
|
+
type io = IO | _ToIO
|
64
|
+
|
65
|
+
# `boolish` is a type for documentation.
|
66
|
+
# It means the value of this type is only for testing a condition.
|
67
|
+
# Unlike `bool` type, it doesn't require the value is one of `true` or `false`.
|
68
|
+
# Any Ruby object can have `boolish` type.
|
69
|
+
#
|
70
|
+
type boolish = top
|
@@ -22,7 +22,7 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
22
22
|
# [nil, true, 99].all? #=> false
|
23
23
|
# [].all? #=> true
|
24
24
|
def all?: () -> bool
|
25
|
-
| () { (Elem
|
25
|
+
| () { (Elem) -> boolish } -> bool
|
26
26
|
|
27
27
|
# Passes each element of the collection to the given block. The method
|
28
28
|
# returns `true` if the block ever returns a value other than `false` or
|
@@ -43,7 +43,7 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
43
43
|
# [].any? #=> false
|
44
44
|
# ```
|
45
45
|
def `any?`: () -> bool
|
46
|
-
| () { (Elem
|
46
|
+
| () { (Elem) -> boolish } -> bool
|
47
47
|
|
48
48
|
def collect: [U] () { (Elem arg0) -> U } -> ::Array[U]
|
49
49
|
| () -> ::Enumerator[Elem, ::Array[untyped]]
|
@@ -62,18 +62,18 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
62
62
|
# ary.count{ |x| x%2==0 } #=> 3
|
63
63
|
# ```
|
64
64
|
def count: () -> Integer
|
65
|
-
| (?untyped
|
66
|
-
| () { (Elem
|
65
|
+
| (?untyped) -> Integer
|
66
|
+
| () { (Elem) -> boolish } -> Integer
|
67
67
|
|
68
68
|
def cycle: (?Integer n) { (Elem arg0) -> untyped } -> NilClass
|
69
69
|
| (?Integer n) -> ::Enumerator[Elem, Return]
|
70
70
|
|
71
|
-
def detect: (?Proc ifnone) { (Elem
|
71
|
+
def detect: (?Proc ifnone) { (Elem) -> boolish } -> Elem?
|
72
72
|
| (?Proc ifnone) -> ::Enumerator[Elem, Return]
|
73
73
|
|
74
74
|
def drop: (Integer n) -> ::Array[Elem]
|
75
75
|
|
76
|
-
def drop_while: () { (Elem
|
76
|
+
def drop_while: () { (Elem) -> boolish } -> ::Array[Elem]
|
77
77
|
| () -> ::Enumerator[Elem, Return]
|
78
78
|
|
79
79
|
def each_cons: (Integer n) { (::Array[Elem] arg0) -> untyped } -> NilClass
|
@@ -96,14 +96,14 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
96
96
|
# ```
|
97
97
|
def entries: () -> ::Array[Elem]
|
98
98
|
|
99
|
-
def find_all: () { (Elem
|
99
|
+
def find_all: () { (Elem) -> boolish } -> ::Array[Elem]
|
100
100
|
| () -> ::Enumerator[Elem, Return]
|
101
101
|
|
102
102
|
alias select find_all
|
103
103
|
alias filter find_all
|
104
104
|
|
105
105
|
def find_index: (?untyped value) -> Integer?
|
106
|
-
| () { (Elem
|
106
|
+
| () { (Elem) -> boolish } -> Integer?
|
107
107
|
| () -> ::Enumerator[Elem, Return]
|
108
108
|
|
109
109
|
# Returns the first element, or the first `n` elements, of the enumerable.
|
@@ -228,7 +228,7 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
228
228
|
# [nil, false, true].none? #=> false
|
229
229
|
# ```
|
230
230
|
def none?: () -> bool
|
231
|
-
| () { (Elem
|
231
|
+
| () { (Elem) -> boolish } -> bool
|
232
232
|
|
233
233
|
# Passes each element of the collection to the given block. The method
|
234
234
|
# returns `true` if the block returns `true` exactly once. If the block is
|
@@ -249,12 +249,12 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
249
249
|
# [].one? #=> false
|
250
250
|
# ```
|
251
251
|
def one?: () -> bool
|
252
|
-
| () { (Elem
|
252
|
+
| () { (Elem) -> boolish } -> bool
|
253
253
|
|
254
|
-
def partition: () { (Elem
|
254
|
+
def partition: () { (Elem) -> boolish } -> [ ::Array[Elem], ::Array[Elem] ]
|
255
255
|
| () -> ::Enumerator[Elem, Return]
|
256
256
|
|
257
|
-
def reject: () { (Elem
|
257
|
+
def reject: () { (Elem) -> boolish } -> ::Array[Elem]
|
258
258
|
| () -> ::Enumerator[Elem, Return]
|
259
259
|
|
260
260
|
def reverse_each: () { (Elem arg0) -> untyped } -> ::Enumerator[Elem, Return]
|
@@ -288,7 +288,7 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
288
288
|
|
289
289
|
def take: (Integer n) -> ::Array[Elem]?
|
290
290
|
|
291
|
-
def take_while: () { (Elem
|
291
|
+
def take_while: () { (Elem) -> boolish } -> ::Array[Elem]
|
292
292
|
| () -> ::Enumerator[Elem, Return]
|
293
293
|
|
294
294
|
# Implemented in C++
|
@@ -307,11 +307,17 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
307
307
|
# ```
|
308
308
|
def to_h: () -> ::Hash[untyped, untyped]
|
309
309
|
|
310
|
-
def each_slice: (Integer n) { (::Array[Elem]
|
310
|
+
def each_slice: (Integer n) { (::Array[Elem]) -> untyped } -> NilClass
|
311
311
|
| (Integer n) -> ::Enumerator[::Array[Elem], Return]
|
312
312
|
|
313
|
-
|
314
|
-
|
313
|
+
interface _NotFound[T]
|
314
|
+
def call: () -> T
|
315
|
+
end
|
316
|
+
|
317
|
+
def find: () { (Elem) -> boolish } -> Elem?
|
318
|
+
| () -> ::Enumerator[Elem, Elem?]
|
319
|
+
| [T] (_NotFound[T] ifnone) { (Elem) -> boolish } -> (Elem | T)
|
320
|
+
| [T] (_NotFound[T] ifnone) -> ::Enumerator[Elem, Elem | T]
|
315
321
|
|
316
322
|
def flat_map: [U] () { (Elem arg0) -> U } -> U
|
317
323
|
| () -> ::Enumerator[Elem, Return]
|
@@ -392,13 +398,13 @@ module Enumerable[unchecked out Elem, out Return]: _Each[Elem, Return]
|
|
392
398
|
def chunk: () -> ::Enumerator[Elem, Return]
|
393
399
|
| [U] () { (Elem elt) -> U } -> ::Enumerator[[U, Array[Elem]], void]
|
394
400
|
|
395
|
-
def chunk_while: () { (Elem elt_before, Elem elt_after) ->
|
401
|
+
def chunk_while: () { (Elem elt_before, Elem elt_after) -> boolish } -> ::Enumerator[::Array[Elem], void]
|
396
402
|
|
397
|
-
def slice_when: () { (Elem elt_before, Elem elt_after) ->
|
403
|
+
def slice_when: () { (Elem elt_before, Elem elt_after) -> boolish } -> ::Enumerator[::Array[Elem], void]
|
398
404
|
|
399
405
|
def slice_after: (untyped pattern) -> ::Enumerator[::Array[Elem], void]
|
400
|
-
| () { (Elem elt) ->
|
406
|
+
| () { (Elem elt) -> boolish } -> ::Enumerator[::Array[Elem], void]
|
401
407
|
|
402
408
|
def slice_before: (untyped pattern) -> ::Enumerator[::Array[Elem], void]
|
403
|
-
| () { (Elem elt) ->
|
409
|
+
| () { (Elem elt) -> boolish } -> ::Enumerator[::Array[Elem], void]
|
404
410
|
end
|
data/stdlib/builtin/errors.rbs
CHANGED
@@ -266,7 +266,7 @@ class NoMethodError[T] < NameError[T]
|
|
266
266
|
#
|
267
267
|
# *receiver* argument stores an object whose method was called.
|
268
268
|
#
|
269
|
-
def initialize: (?string? msg, ?String? name, ?Array[untyped] args, ?
|
269
|
+
def initialize: (?string? msg, ?String? name, ?Array[untyped] args, ?boolish `private`, ?receiver: T?) -> void
|
270
270
|
|
271
271
|
public
|
272
272
|
|
data/stdlib/builtin/gc.rbs
CHANGED
@@ -42,7 +42,7 @@ module GC
|
|
42
42
|
# are not guaranteed to be future-compatible, and may be ignored if the
|
43
43
|
# underlying implementation does not support them.
|
44
44
|
#
|
45
|
-
def self.start: (?immediate_sweep:
|
45
|
+
def self.start: (?immediate_sweep: boolish immediate_sweep, ?immediate_mark: boolish immediate_mark, ?full_mark: boolish full_mark) -> nil
|
46
46
|
|
47
47
|
# Returns a Hash containing information about the GC.
|
48
48
|
#
|
@@ -132,7 +132,7 @@ module GC
|
|
132
132
|
| [K] (?Hash[K, untyped] hash) -> ::Hash[::Symbol | K, untyped]
|
133
133
|
| (Symbol key) -> untyped
|
134
134
|
|
135
|
-
def garbage_collect: (?immediate_sweep:
|
135
|
+
def garbage_collect: (?immediate_sweep: boolish immediate_sweep, ?immediate_mark: boolish immediate_mark, ?full_mark: boolish full_mark) -> nil
|
136
136
|
end
|
137
137
|
|
138
138
|
# internal constants
|
data/stdlib/builtin/hash.rbs
CHANGED
@@ -230,7 +230,7 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
230
230
|
#
|
231
231
|
def any?: () -> bool
|
232
232
|
| (untyped pattern) -> bool
|
233
|
-
| () { (K, V) ->
|
233
|
+
| () { (K, V) -> boolish } -> bool
|
234
234
|
|
235
235
|
# Searches through the hash comparing *obj* with the key using `==`. Returns the
|
236
236
|
# key-value pair (two elements array) or `nil` if no match is found. See
|
@@ -360,7 +360,7 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
360
360
|
# h = { "a" => 100, "b" => 200, "c" => 300 }
|
361
361
|
# h.delete_if {|key, value| key >= "b" } #=> {"a"=>100}
|
362
362
|
#
|
363
|
-
def delete_if: () { (K
|
363
|
+
def delete_if: () { (K, V) -> boolish } -> self
|
364
364
|
| () -> ::Enumerator[[ K, V ], self]
|
365
365
|
|
366
366
|
# Extracts the nested value specified by the sequence of *key* objects by
|
@@ -498,14 +498,14 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
498
498
|
#
|
499
499
|
# Hash#filter is an alias for Hash#select.
|
500
500
|
#
|
501
|
-
def filter: () { (K
|
501
|
+
def filter: () { (K, V) -> boolish } -> self
|
502
502
|
| () -> ::Enumerator[[ K, V ], self]
|
503
503
|
|
504
504
|
# Equivalent to Hash#keep_if, but returns `nil` if no changes were made.
|
505
505
|
#
|
506
506
|
# Hash#filter! is an alias for Hash#select!.
|
507
507
|
#
|
508
|
-
def filter!: () { (K
|
508
|
+
def filter!: () { (K, V) -> boolish } -> self?
|
509
509
|
| () -> ::Enumerator[[ K, V ], self?]
|
510
510
|
|
511
511
|
# Returns a new array that is a one-dimensional flattening of this hash. That
|
@@ -604,7 +604,7 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
604
604
|
#
|
605
605
|
# See also Hash#select!.
|
606
606
|
#
|
607
|
-
def keep_if: () { (K, V) ->
|
607
|
+
def keep_if: () { (K, V) -> boolish } -> self
|
608
608
|
| () -> ::Enumerator[[ K, V ], self]
|
609
609
|
|
610
610
|
# Returns the key of an occurrence of a given value. If the value is not found,
|
@@ -758,12 +758,12 @@ class Hash[unchecked out K, unchecked out V] < Object
|
|
758
758
|
# h.reject {|k,v| v > 100} #=> {"a" => 100}
|
759
759
|
#
|
760
760
|
def reject: () -> ::Enumerator[[ K, V ], self]
|
761
|
-
| () { (K
|
761
|
+
| () { (K, V) -> boolish } -> self
|
762
762
|
|
763
763
|
# Equivalent to Hash#delete_if, but returns `nil` if no changes were made.
|
764
764
|
#
|
765
765
|
def reject!: () -> ::Enumerator[[ K, V ], self?]
|
766
|
-
| () { (K
|
766
|
+
| () { (K, V) -> boolish } -> self?
|
767
767
|
|
768
768
|
# Replaces the contents of *hsh* with the contents of *other_hash*.
|
769
769
|
#
|
data/stdlib/builtin/io.rbs
CHANGED
@@ -111,7 +111,7 @@ class IO < Object
|
|
111
111
|
|
112
112
|
def advise: (Symbol arg0, ?Integer offset, ?Integer len) -> NilClass
|
113
113
|
|
114
|
-
def autoclose=: (
|
114
|
+
def autoclose=: (boolish) -> bool
|
115
115
|
|
116
116
|
# Returns `true` if the underlying file descriptor of *ios* will be closed
|
117
117
|
# automatically at its finalization, otherwise `false` .
|
@@ -141,7 +141,7 @@ class IO < Object
|
|
141
141
|
# just ignored since Ruby 2.3.
|
142
142
|
def close: () -> NilClass
|
143
143
|
|
144
|
-
def close_on_exec=: (
|
144
|
+
def close_on_exec=: (boolish) -> bool
|
145
145
|
|
146
146
|
# Returns `true` if *ios* will be closed on exec.
|
147
147
|
#
|
@@ -474,7 +474,7 @@ class IO < Object
|
|
474
474
|
# ```
|
475
475
|
def sync: () -> bool
|
476
476
|
|
477
|
-
def sync=: (
|
477
|
+
def sync=: (boolish) -> bool
|
478
478
|
|
479
479
|
def sysread: (Integer maxlen, String outbuf) -> String
|
480
480
|
|
@@ -514,7 +514,7 @@ class IO < Object
|
|
514
514
|
|
515
515
|
def self.binwrite: (String name, _ToS arg0, ?Integer offset, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> Integer
|
516
516
|
|
517
|
-
def self.copy_stream: (
|
517
|
+
def self.copy_stream: (_Reader src, _Writer dst, ?Integer copy_length, ?Integer src_offset) -> Integer
|
518
518
|
|
519
519
|
def self.popen: (*untyped args) -> untyped
|
520
520
|
|
@@ -522,7 +522,7 @@ class IO < Object
|
|
522
522
|
|
523
523
|
def self.readlines: (String name, ?String sep, ?Integer limit, ?external_encoding: String external_encoding, ?internal_encoding: String internal_encoding, ?encoding: String encoding, ?textmode: untyped textmode, ?binmode: untyped binmode, ?autoclose: untyped autoclose, ?mode: String mode) -> ::Array[String]
|
524
524
|
|
525
|
-
def self.select: (::Array[
|
525
|
+
def self.select: (::Array[io]? read_array, ?::Array[io]? write_array, ?::Array[io]? error_array, ?Integer? timeout) -> ::Array[::Array[io]]?
|
526
526
|
|
527
527
|
def self.sysopen: (String path, ?String mode, ?String perm) -> Integer
|
528
528
|
|
data/stdlib/builtin/kernel.rbs
CHANGED
@@ -71,28 +71,6 @@ module Kernel
|
|
71
71
|
|
72
72
|
def srand: (?Numeric number) -> Numeric
|
73
73
|
|
74
|
-
def !~: (untyped other) -> bool
|
75
|
-
|
76
|
-
def <=>: (untyped other) -> Integer?
|
77
|
-
|
78
|
-
def ===: (untyped other) -> bool
|
79
|
-
|
80
|
-
def =~: (untyped other) -> NilClass
|
81
|
-
|
82
|
-
def clone: (?freeze: (TrueClass | FalseClass)) -> self
|
83
|
-
|
84
|
-
def display: (?IO port) -> NilClass
|
85
|
-
|
86
|
-
def dup: () -> self
|
87
|
-
|
88
|
-
def enum_for: (Symbol method, *untyped args) -> ::Enumerator[untyped, untyped]
|
89
|
-
| (Symbol method, *untyped args) { (*untyped args) -> (Integer|Float|nil) } -> ::Enumerator[untyped, untyped]
|
90
|
-
alias to_enum enum_for
|
91
|
-
|
92
|
-
def eql?: (untyped other) -> bool
|
93
|
-
|
94
|
-
def `extend`: (*Module mod) -> self
|
95
|
-
|
96
74
|
# Creates a subprocess. If a block is specified, that block is run in the
|
97
75
|
# subprocess, and the subprocess terminates with a status of zero.
|
98
76
|
# Otherwise, the `fork` call returns twice, once in the parent, returning
|
@@ -113,70 +91,8 @@ module Kernel
|
|
113
91
|
def fork: () -> Integer?
|
114
92
|
| () { () -> untyped } -> Integer?
|
115
93
|
|
116
|
-
def freeze: () -> self
|
117
|
-
|
118
|
-
def frozen?: () -> bool
|
119
|
-
|
120
|
-
def hash: () -> Integer
|
121
|
-
|
122
94
|
def initialize_copy: (self object) -> self
|
123
95
|
|
124
|
-
def inspect: () -> String
|
125
|
-
|
126
|
-
def instance_of?: (Class arg0) -> bool
|
127
|
-
|
128
|
-
def instance_variable_defined?: (Symbol | String arg0) -> bool
|
129
|
-
|
130
|
-
def instance_variable_get: (Symbol | String arg0) -> untyped
|
131
|
-
|
132
|
-
def instance_variable_set: [T] (Symbol | String arg0, T arg1) -> T
|
133
|
-
|
134
|
-
def instance_variables: () -> ::Array[Symbol]
|
135
|
-
|
136
|
-
def is_a?: (Class | Module arg0) -> bool
|
137
|
-
alias kind_of? is_a?
|
138
|
-
|
139
|
-
def method: (Symbol | String arg0) -> Method
|
140
|
-
|
141
|
-
def methods: (?bool regular) -> ::Array[Symbol]
|
142
|
-
|
143
|
-
def `nil?`: () -> FalseClass
|
144
|
-
|
145
|
-
def private_methods: (?bool all) -> ::Array[Symbol]
|
146
|
-
|
147
|
-
def protected_methods: (?bool all) -> ::Array[Symbol]
|
148
|
-
|
149
|
-
def public_method: (Symbol | String arg0) -> Method
|
150
|
-
|
151
|
-
def public_methods: (?bool all) -> ::Array[Symbol]
|
152
|
-
|
153
|
-
def `public_send`: (Symbol | String arg0, *untyped args) -> untyped
|
154
|
-
| (Symbol | String arg0, *untyped args) { (*untyped) -> untyped } -> untyped
|
155
|
-
|
156
|
-
def remove_instance_variable: (Symbol | String arg0) -> untyped
|
157
|
-
|
158
|
-
def `send`: (String | Symbol arg0, *untyped arg1) -> untyped
|
159
|
-
| (String | Symbol arg0, *untyped arg1) { (*untyped) -> untyped } -> untyped
|
160
|
-
|
161
|
-
def `singleton_class`: () -> Class
|
162
|
-
|
163
|
-
def singleton_method: (Symbol | String arg0) -> Method
|
164
|
-
|
165
|
-
def singleton_methods: (?bool all) -> ::Array[Symbol]
|
166
|
-
|
167
|
-
def taint: () -> self
|
168
|
-
alias untrust taint
|
169
|
-
|
170
|
-
def tainted?: () -> bool
|
171
|
-
alias untrusted? tainted?
|
172
|
-
|
173
|
-
def tap: () { (untyped x) -> void } -> self
|
174
|
-
|
175
|
-
def to_s: () -> String
|
176
|
-
|
177
|
-
def untaint: () -> self
|
178
|
-
alias trust untaint
|
179
|
-
|
180
96
|
# Returns `arg` as an [Array](https://ruby-doc.org/core-2.6.3/Array.html)
|
181
97
|
# .
|
182
98
|
#
|
@@ -331,7 +247,7 @@ module Kernel
|
|
331
247
|
# ```
|
332
248
|
def global_variables: () -> ::Array[Symbol]
|
333
249
|
|
334
|
-
def load: (String filename, ?
|
250
|
+
def load: (String filename, ?boolish) -> bool
|
335
251
|
|
336
252
|
# Repeatedly executes the block.
|
337
253
|
#
|
data/stdlib/builtin/module.rbs
CHANGED
@@ -237,7 +237,7 @@ class Module < Object
|
|
237
237
|
# B.autoload?(:CONST) #=> "const.rb", found in A (ancestor)
|
238
238
|
# B.autoload?(:CONST, false) #=> nil, not found in B itself
|
239
239
|
#
|
240
|
-
def autoload?: (Symbol name, ?
|
240
|
+
def autoload?: (Symbol name, ?boolish inherit) -> String?
|
241
241
|
|
242
242
|
# Evaluates the string or block in the context of *mod*, except that when a
|
243
243
|
# block is given, constant/class variable lookup is not affected. This can be
|
@@ -329,7 +329,7 @@ class Module < Object
|
|
329
329
|
# Two.class_variables #=> [:@@var2, :@@var1]
|
330
330
|
# Two.class_variables(false) #=> [:@@var2]
|
331
331
|
#
|
332
|
-
def class_variables: (?
|
332
|
+
def class_variables: (?boolish inherit) -> ::Array[Symbol]
|
333
333
|
|
334
334
|
# Says whether *mod* or its ancestors have a constant with the given name:
|
335
335
|
#
|
@@ -364,7 +364,7 @@ class Module < Object
|
|
364
364
|
#
|
365
365
|
# Hash.const_defined? 'foobar' #=> NameError: wrong constant name foobar
|
366
366
|
#
|
367
|
-
def const_defined?: (Symbol | String
|
367
|
+
def const_defined?: (Symbol | String name, ?boolish inherit) -> bool
|
368
368
|
|
369
369
|
# Checks for a constant with the given name in *mod*. If `inherit` is set, the
|
370
370
|
# lookup will also search the ancestors (and `Object` if *mod* is a `Module`).
|
@@ -398,7 +398,7 @@ class Module < Object
|
|
398
398
|
#
|
399
399
|
# Object.const_get 'foobar' #=> NameError: wrong constant name foobar
|
400
400
|
#
|
401
|
-
def const_get: (Symbol | String
|
401
|
+
def const_get: (Symbol | String name, ?boolish inherit) -> untyped
|
402
402
|
|
403
403
|
# Invoked when a reference is made to an undefined constant in *mod*. It is
|
404
404
|
# passed a symbol for the undefined constant, and returns a value to be used for
|
@@ -455,7 +455,7 @@ class Module < Object
|
|
455
455
|
#
|
456
456
|
# Also see Module#const_defined?.
|
457
457
|
#
|
458
|
-
def constants: (?
|
458
|
+
def constants: (?boolish inherit) -> ::Array[Symbol]
|
459
459
|
|
460
460
|
# Defines an instance method in the receiver. The *method* parameter can be a
|
461
461
|
# `Proc`, a `Method` or an `UnboundMethod` object. If a block is specified, it
|
@@ -662,7 +662,7 @@ class Module < Object
|
|
662
662
|
# C.instance_methods(false) #=> [:method3]
|
663
663
|
# C.instance_methods.include?(:method2) #=> true
|
664
664
|
#
|
665
|
-
def instance_methods: (?
|
665
|
+
def instance_methods: (?boolish include_super) -> ::Array[Symbol]
|
666
666
|
|
667
667
|
# Invoked as a callback whenever an instance method is added to the receiver.
|
668
668
|
#
|
@@ -709,7 +709,7 @@ class Module < Object
|
|
709
709
|
# C.method_defined? "method4" #=> false
|
710
710
|
# C.method_defined? "private_method2" #=> false
|
711
711
|
#
|
712
|
-
def method_defined?: (Symbol | String
|
712
|
+
def method_defined?: (Symbol | String name, ?boolish inherit) -> bool
|
713
713
|
|
714
714
|
# Invoked as a callback whenever an instance method is removed from the
|
715
715
|
# receiver.
|
@@ -881,7 +881,7 @@ class Module < Object
|
|
881
881
|
# Mod.instance_methods #=> [:method2]
|
882
882
|
# Mod.private_instance_methods #=> [:method1]
|
883
883
|
#
|
884
|
-
def private_instance_methods: (?
|
884
|
+
def private_instance_methods: (?boolish include_super) -> ::Array[Symbol]
|
885
885
|
|
886
886
|
# Returns `true` if the named private method is defined by *mod*. If *inherit*
|
887
887
|
# is set, the lookup will also search *mod*'s ancestors. String arguments are
|
@@ -906,7 +906,7 @@ class Module < Object
|
|
906
906
|
# C.private_method_defined? "method2", false #=> false
|
907
907
|
# C.method_defined? "method2" #=> false
|
908
908
|
#
|
909
|
-
def private_method_defined?: (Symbol | String
|
909
|
+
def private_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
|
910
910
|
|
911
911
|
# With no arguments, sets the default visibility for subsequently defined
|
912
912
|
# methods to protected. With arguments, sets the named methods to have protected
|
@@ -926,7 +926,7 @@ class Module < Object
|
|
926
926
|
# Returns a list of the protected instance methods defined in *mod*. If the
|
927
927
|
# optional parameter is `false`, the methods of any ancestors are not included.
|
928
928
|
#
|
929
|
-
def protected_instance_methods: (?
|
929
|
+
def protected_instance_methods: (?boolish include_super) -> ::Array[Symbol]
|
930
930
|
|
931
931
|
# Returns `true` if the named protected method is defined *mod*. If *inherit*
|
932
932
|
# is set, the lookup will also search *mod*'s ancestors. String arguments are
|
@@ -951,7 +951,7 @@ class Module < Object
|
|
951
951
|
# C.protected_method_defined? "method2", false #=> false
|
952
952
|
# C.method_defined? "method2" #=> true
|
953
953
|
#
|
954
|
-
def protected_method_defined?: (Symbol | String
|
954
|
+
def protected_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
|
955
955
|
|
956
956
|
# With no arguments, sets the default visibility for subsequently defined
|
957
957
|
# methods to public. With arguments, sets the named methods to have public
|
@@ -976,7 +976,7 @@ class Module < Object
|
|
976
976
|
# Returns a list of the public instance methods defined in *mod*. If the
|
977
977
|
# optional parameter is `false`, the methods of any ancestors are not included.
|
978
978
|
#
|
979
|
-
def public_instance_methods: (?
|
979
|
+
def public_instance_methods: (?boolish include_super) -> ::Array[Symbol]
|
980
980
|
|
981
981
|
# Returns `true` if the named public method is defined by *mod*. If *inherit*
|
982
982
|
# is set, the lookup will also search *mod*'s ancestors. String arguments are
|
@@ -1001,7 +1001,7 @@ class Module < Object
|
|
1001
1001
|
# C.public_method_defined? "method2" #=> false
|
1002
1002
|
# C.method_defined? "method2" #=> true
|
1003
1003
|
#
|
1004
|
-
def public_method_defined?: (Symbol | String
|
1004
|
+
def public_method_defined?: (Symbol | String name, ?boolish inherit) -> bool
|
1005
1005
|
|
1006
1006
|
# Refine *mod* in the receiver.
|
1007
1007
|
#
|