rbs 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +0 -1
- data/CHANGELOG.md +7 -2
- data/Gemfile +3 -0
- data/README.md +8 -2
- data/Steepfile +1 -0
- data/bin/annotate-with-rdoc +1 -1
- data/bin/setup +0 -2
- data/docs/CONTRIBUTING.md +1 -0
- data/goodcheck.yml +22 -5
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/definition_builder.rb +4 -5
- data/lib/rbs/environment.rb +1 -1
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/parser.rb +3146 -0
- data/lib/rbs/parser.y +7 -2
- data/lib/rbs/test/setup_helper.rb +4 -4
- data/lib/rbs/test/type_check.rb +2 -2
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/variance_calculator.rb +1 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +1 -1
- data/sig/constant.rbs +2 -2
- data/sig/constant_table.rbs +10 -10
- data/sig/declarations.rbs +1 -1
- data/sig/definition.rbs +1 -1
- data/sig/namespace.rbs +3 -3
- data/sig/parser.rbs +25 -0
- data/sig/substitution.rbs +3 -3
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +1 -1
- data/sig/writer.rbs +15 -15
- data/stdlib/benchmark/benchmark.rbs +2 -2
- data/stdlib/builtin/basic_object.rbs +54 -54
- data/stdlib/builtin/binding.rbs +42 -42
- data/stdlib/builtin/class.rbs +33 -33
- data/stdlib/builtin/complex.rbs +90 -90
- data/stdlib/builtin/encoding.rbs +33 -33
- data/stdlib/builtin/enumerable.rbs +32 -32
- data/stdlib/builtin/enumerator.rbs +35 -35
- data/stdlib/builtin/errors.rbs +1 -1
- data/stdlib/builtin/exception.rbs +50 -50
- data/stdlib/builtin/false_class.rbs +6 -6
- data/stdlib/builtin/fiber.rbs +14 -14
- data/stdlib/builtin/fiber_error.rbs +1 -1
- data/stdlib/builtin/float.rbs +161 -161
- data/stdlib/builtin/gc.rbs +1 -1
- data/stdlib/builtin/io.rbs +83 -83
- data/stdlib/builtin/kernel.rbs +69 -69
- data/stdlib/builtin/match_data.rbs +1 -1
- data/stdlib/builtin/method.rbs +19 -19
- data/stdlib/builtin/nil_class.rbs +20 -20
- data/stdlib/builtin/numeric.rbs +101 -101
- data/stdlib/builtin/object.rbs +172 -172
- data/stdlib/builtin/proc.rbs +91 -91
- data/stdlib/builtin/range.rbs +2 -4
- data/stdlib/builtin/rational.rbs +83 -83
- data/stdlib/builtin/signal.rbs +7 -7
- data/stdlib/builtin/string.rbs +4 -4
- data/stdlib/builtin/string_io.rbs +1 -1
- data/stdlib/builtin/thread.rbs +185 -185
- data/stdlib/builtin/thread_group.rbs +2 -2
- data/stdlib/builtin/true_class.rbs +9 -9
- data/stdlib/builtin/warning.rbs +1 -1
- data/stdlib/date/date.rbs +2 -2
- data/stdlib/find/find.rbs +10 -10
- data/stdlib/pathname/pathname.rbs +1 -1
- data/stdlib/tmpdir/tmpdir.rbs +12 -12
- metadata +3 -2
data/stdlib/builtin/proc.rbs
CHANGED
@@ -3,152 +3,152 @@
|
|
3
3
|
# [Proc](Proc), and can be called.
|
4
4
|
# [Proc](Proc) is an essential concept in Ruby and a
|
5
5
|
# core of its functional programming features.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# ```ruby
|
8
8
|
# square = Proc.new {|x| x**2 }
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# square.call(3) #=> 9
|
11
11
|
# # shorthands:
|
12
12
|
# square.(3) #=> 9
|
13
13
|
# square[3] #=> 9
|
14
14
|
# ```
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# [Proc](Proc) objects are *closures* , meaning they
|
17
17
|
# remember and can use the entire context in which they were created.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# ```ruby
|
20
20
|
# def gen_times(factor)
|
21
21
|
# Proc.new {|n| n*factor } # remembers the value of factor at the moment of creation
|
22
22
|
# end
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# times3 = gen_times(3)
|
25
25
|
# times5 = gen_times(5)
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# times3.call(12) #=> 36
|
28
28
|
# times5.call(5) #=> 25
|
29
29
|
# times3.call(times5.call(4)) #=> 60
|
30
30
|
# ```
|
31
|
-
#
|
32
|
-
#
|
31
|
+
#
|
32
|
+
#
|
33
33
|
# There are several methods to create a [Proc](Proc)
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# - Use the [Proc](Proc) class constructor:
|
36
|
-
#
|
36
|
+
#
|
37
37
|
# ```ruby
|
38
38
|
# proc1 = Proc.new {|x| x**2 }
|
39
39
|
# ```
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# - Use the
|
42
42
|
# [Kernel\#proc](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-proc)
|
43
43
|
# method as a shorthand of
|
44
44
|
# [::new](Proc#method-c-new):
|
45
|
-
#
|
45
|
+
#
|
46
46
|
# ```ruby
|
47
47
|
# proc2 = proc {|x| x**2 }
|
48
48
|
# ```
|
49
|
-
#
|
49
|
+
#
|
50
50
|
# - Receiving a block of code into proc argument (note the `&` ):
|
51
|
-
#
|
51
|
+
#
|
52
52
|
# ```ruby
|
53
53
|
# def make_proc(&block)
|
54
54
|
# block
|
55
55
|
# end
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# proc3 = make_proc {|x| x**2 }
|
58
58
|
# ```
|
59
|
-
#
|
59
|
+
#
|
60
60
|
# - Construct a proc with lambda semantics using the
|
61
61
|
# [Kernel\#lambda](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-lambda)
|
62
62
|
# method (see below for explanations about lambdas):
|
63
|
-
#
|
63
|
+
#
|
64
64
|
# ```ruby
|
65
65
|
# lambda1 = lambda {|x| x**2 }
|
66
66
|
# ```
|
67
|
-
#
|
67
|
+
#
|
68
68
|
# - Use the Lambda literal syntax (also constructs a proc with lambda
|
69
69
|
# semantics):
|
70
|
-
#
|
70
|
+
#
|
71
71
|
# ```ruby
|
72
72
|
# lambda2 = ->(x) { x**2 }
|
73
73
|
# ```
|
74
|
-
#
|
75
|
-
#
|
74
|
+
#
|
75
|
+
#
|
76
76
|
# Procs are coming in two flavors: lambda and non-lambda (regular procs).
|
77
77
|
# Differences are:
|
78
|
-
#
|
78
|
+
#
|
79
79
|
# - In lambdas, `return` means exit from this lambda;
|
80
|
-
#
|
80
|
+
#
|
81
81
|
# - In regular procs, `return` means exit from embracing method (and
|
82
82
|
# will throw `LocalJumpError` if invoked outside the method);
|
83
|
-
#
|
83
|
+
#
|
84
84
|
# - In lambdas, arguments are treated in the same way as in methods:
|
85
85
|
# strict, with `ArgumentError` for mismatching argument number, and no
|
86
86
|
# additional argument processing;
|
87
|
-
#
|
87
|
+
#
|
88
88
|
# - Regular procs accept arguments more generously: missing arguments
|
89
89
|
# are filled with `nil`, single
|
90
90
|
# [Array](https://ruby-doc.org/core-2.6.3/Array.html) arguments are
|
91
91
|
# deconstructed if the proc has multiple arguments, and there is no
|
92
92
|
# error raised on extra arguments.
|
93
|
-
#
|
93
|
+
#
|
94
94
|
# Examples:
|
95
|
-
#
|
95
|
+
#
|
96
96
|
# ```ruby
|
97
97
|
# p = proc {|x, y| "x=#{x}, y=#{y}" }
|
98
98
|
# p.call(1, 2) #=> "x=1, y=2"
|
99
99
|
# p.call([1, 2]) #=> "x=1, y=2", array deconstructed
|
100
100
|
# p.call(1, 2, 8) #=> "x=1, y=2", extra argument discarded
|
101
101
|
# p.call(1) #=> "x=1, y=", nil substituted instead of error
|
102
|
-
#
|
102
|
+
#
|
103
103
|
# l = lambda {|x, y| "x=#{x}, y=#{y}" }
|
104
104
|
# l.call(1, 2) #=> "x=1, y=2"
|
105
105
|
# l.call([1, 2]) # ArgumentError: wrong number of arguments (given 1, expected 2)
|
106
106
|
# l.call(1, 2, 8) # ArgumentError: wrong number of arguments (given 3, expected 2)
|
107
107
|
# l.call(1) # ArgumentError: wrong number of arguments (given 1, expected 2)
|
108
|
-
#
|
108
|
+
#
|
109
109
|
# def test_return
|
110
110
|
# -> { return 3 }.call # just returns from lambda into method body
|
111
111
|
# proc { return 4 }.call # returns from method
|
112
112
|
# return 5
|
113
113
|
# end
|
114
|
-
#
|
114
|
+
#
|
115
115
|
# test_return # => 4, return from proc
|
116
116
|
# ```
|
117
|
-
#
|
117
|
+
#
|
118
118
|
# Lambdas are useful as self-sufficient functions, in particular useful as
|
119
119
|
# arguments to higher-order functions, behaving exactly like Ruby methods.
|
120
|
-
#
|
120
|
+
#
|
121
121
|
# Procs are useful for implementing iterators:
|
122
|
-
#
|
122
|
+
#
|
123
123
|
# ```ruby
|
124
124
|
# def test
|
125
125
|
# [[1, 2], [3, 4], [5, 6]].map {|a, b| return a if a + b > 10 }
|
126
126
|
# # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
127
127
|
# end
|
128
128
|
# ```
|
129
|
-
#
|
129
|
+
#
|
130
130
|
# Inside `map`, the block of code is treated as a regular (non-lambda)
|
131
131
|
# proc, which means that the internal arrays will be deconstructed to
|
132
132
|
# pairs of arguments, and `return` will exit from the method `test` . That
|
133
133
|
# would not be possible with a stricter lambda.
|
134
|
-
#
|
134
|
+
#
|
135
135
|
# You can tell a lambda from a regular proc by using the
|
136
136
|
# [lambda?](Proc#method-i-lambda-3F) instance method.
|
137
|
-
#
|
137
|
+
#
|
138
138
|
# Lambda semantics is typically preserved during the proc lifetime,
|
139
139
|
# including `&` -deconstruction to a block of code:
|
140
|
-
#
|
140
|
+
#
|
141
141
|
# ```ruby
|
142
142
|
# p = proc {|x, y| x }
|
143
143
|
# l = lambda {|x, y| x }
|
144
144
|
# [[1, 2], [3, 4]].map(&p) #=> [1, 2]
|
145
145
|
# [[1, 2], [3, 4]].map(&l) # ArgumentError: wrong number of arguments (given 1, expected 2)
|
146
146
|
# ```
|
147
|
-
#
|
147
|
+
#
|
148
148
|
# The only exception is dynamic method definition: even if defined by
|
149
149
|
# passing a non-lambda proc, methods still have normal semantics of
|
150
150
|
# argument checking.
|
151
|
-
#
|
151
|
+
#
|
152
152
|
# ```ruby
|
153
153
|
# class C
|
154
154
|
# define_method(:e, &proc {})
|
@@ -156,57 +156,57 @@
|
|
156
156
|
# C.new.e(1,2) #=> ArgumentError
|
157
157
|
# C.new.method(:e).to_proc.lambda? #=> true
|
158
158
|
# ```
|
159
|
-
#
|
159
|
+
#
|
160
160
|
# This exception ensures that methods never have unusual argument passing
|
161
161
|
# conventions, and makes it easy to have wrappers defining methods that
|
162
162
|
# behave as usual.
|
163
|
-
#
|
163
|
+
#
|
164
164
|
# ```ruby
|
165
165
|
# class C
|
166
166
|
# def self.def2(name, &body)
|
167
167
|
# define_method(name, &body)
|
168
168
|
# end
|
169
|
-
#
|
169
|
+
#
|
170
170
|
# def2(:f) {}
|
171
171
|
# end
|
172
172
|
# C.new.f(1,2) #=> ArgumentError
|
173
173
|
# ```
|
174
|
-
#
|
174
|
+
#
|
175
175
|
# The wrapper *def2* receives `body` as a non-lambda proc, yet defines a
|
176
176
|
# method which has normal semantics.
|
177
|
-
#
|
178
|
-
#
|
177
|
+
#
|
178
|
+
#
|
179
179
|
# Any object that implements the `to_proc` method can be converted into a
|
180
180
|
# proc by the `&` operator, and therefore con be consumed by iterators.
|
181
|
-
#
|
181
|
+
#
|
182
182
|
# ```ruby
|
183
183
|
# class Greater
|
184
184
|
# def initialize(greating)
|
185
185
|
# @greating = greating
|
186
186
|
# end
|
187
|
-
#
|
187
|
+
#
|
188
188
|
# def to_proc
|
189
189
|
# proc {|name| "#{@greating}, #{name}!" }
|
190
190
|
# end
|
191
191
|
# end
|
192
|
-
#
|
192
|
+
#
|
193
193
|
# hi = Greater.new("Hi")
|
194
194
|
# hey = Greater.new("Hey")
|
195
195
|
# ["Bob", "Jane"].map(&hi) #=> ["Hi, Bob!", "Hi, Jane!"]
|
196
196
|
# ["Bob", "Jane"].map(&hey) #=> ["Hey, Bob!", "Hey, Jane!"]
|
197
197
|
# ```
|
198
|
-
#
|
198
|
+
#
|
199
199
|
# Of the Ruby core classes, this method is implemented by
|
200
200
|
# [Symbol](https://ruby-doc.org/core-2.6.3/Symbol.html),
|
201
201
|
# [Method](https://ruby-doc.org/core-2.6.3/Method.html), and
|
202
202
|
# [Hash](https://ruby-doc.org/core-2.6.3/Hash.html).
|
203
|
-
#
|
203
|
+
#
|
204
204
|
# :to_s.to_proc.call(1) #=> "1"
|
205
205
|
# [1, 2].map(&:to_s) #=> ["1", "2"]
|
206
|
-
#
|
206
|
+
#
|
207
207
|
# method(:puts).to_proc.call(1) # prints 1
|
208
208
|
# [1, 2].each(&method(:puts)) # prints 1, 2
|
209
|
-
#
|
209
|
+
#
|
210
210
|
# {test: 1}.to_proc.call(:test) #=> 1
|
211
211
|
# %i[test many keys].map(&{test: 1}) #=> [1, nil, nil]
|
212
212
|
class Proc < Object
|
@@ -220,7 +220,7 @@ class Proc < Object
|
|
220
220
|
# mandatory if any keyword argument is mandatory. A `proc` with no
|
221
221
|
# argument declarations is the same as a block declaring `||` as its
|
222
222
|
# arguments.
|
223
|
-
#
|
223
|
+
#
|
224
224
|
# proc {}.arity #=> 0
|
225
225
|
# proc { || }.arity #=> 0
|
226
226
|
# proc { |a| }.arity #=> 1
|
@@ -231,7 +231,7 @@ class Proc < Object
|
|
231
231
|
# proc { |a, *b, c| }.arity #=> -3
|
232
232
|
# proc { |x:, y:, z:0| }.arity #=> 1
|
233
233
|
# proc { |*a, x:, y:0| }.arity #=> -2
|
234
|
-
#
|
234
|
+
#
|
235
235
|
# proc { |a=0| }.arity #=> 0
|
236
236
|
# lambda { |a=0| }.arity #=> -1
|
237
237
|
# proc { |a=0, b| }.arity #=> 1
|
@@ -247,12 +247,12 @@ class Proc < Object
|
|
247
247
|
def arity: () -> Integer
|
248
248
|
|
249
249
|
# Returns the binding associated with *prc* .
|
250
|
-
#
|
250
|
+
#
|
251
251
|
# ```ruby
|
252
252
|
# def fred(param)
|
253
253
|
# proc {}
|
254
254
|
# end
|
255
|
-
#
|
255
|
+
#
|
256
256
|
# b = fred(99)
|
257
257
|
# eval("param", b.binding) #=> 99
|
258
258
|
# ```
|
@@ -265,7 +265,7 @@ class Proc < Object
|
|
265
265
|
def curry: (?Integer arity) -> Proc
|
266
266
|
|
267
267
|
# Returns a hash value corresponding to proc body.
|
268
|
-
#
|
268
|
+
#
|
269
269
|
# See also Object\#hash.
|
270
270
|
def hash: () -> Integer
|
271
271
|
|
@@ -274,94 +274,94 @@ class Proc < Object
|
|
274
274
|
# Returns `true` for a [Proc](Proc.downloaded.ruby_doc) object for which
|
275
275
|
# argument handling is rigid. Such procs are typically generated by
|
276
276
|
# `lambda` .
|
277
|
-
#
|
277
|
+
#
|
278
278
|
# A [Proc](Proc.downloaded.ruby_doc) object generated by `proc` ignores
|
279
279
|
# extra arguments.
|
280
|
-
#
|
280
|
+
#
|
281
281
|
# ```ruby
|
282
282
|
# proc {|a,b| [a,b] }.call(1,2,3) #=> [1,2]
|
283
283
|
# ```
|
284
|
-
#
|
284
|
+
#
|
285
285
|
# It provides `nil` for missing arguments.
|
286
|
-
#
|
286
|
+
#
|
287
287
|
# ```ruby
|
288
288
|
# proc {|a,b| [a,b] }.call(1) #=> [1,nil]
|
289
289
|
# ```
|
290
|
-
#
|
290
|
+
#
|
291
291
|
# It expands a single array argument.
|
292
|
-
#
|
292
|
+
#
|
293
293
|
# ```ruby
|
294
294
|
# proc {|a,b| [a,b] }.call([1,2]) #=> [1,2]
|
295
295
|
# ```
|
296
|
-
#
|
296
|
+
#
|
297
297
|
# A [Proc](Proc.downloaded.ruby_doc) object generated by `lambda` doesn’t
|
298
298
|
# have such tricks.
|
299
|
-
#
|
299
|
+
#
|
300
300
|
# ```ruby
|
301
301
|
# lambda {|a,b| [a,b] }.call(1,2,3) #=> ArgumentError
|
302
302
|
# lambda {|a,b| [a,b] }.call(1) #=> ArgumentError
|
303
303
|
# lambda {|a,b| [a,b] }.call([1,2]) #=> ArgumentError
|
304
304
|
# ```
|
305
|
-
#
|
305
|
+
#
|
306
306
|
# [\#lambda?](Proc.downloaded.ruby_doc#method-i-lambda-3F) is a predicate
|
307
307
|
# for the tricks. It returns `true` if no tricks apply.
|
308
|
-
#
|
308
|
+
#
|
309
309
|
# ```ruby
|
310
310
|
# lambda {}.lambda? #=> true
|
311
311
|
# proc {}.lambda? #=> false
|
312
312
|
# ```
|
313
|
-
#
|
313
|
+
#
|
314
314
|
# [::new](Proc.downloaded.ruby_doc#method-c-new) is the same as `proc` .
|
315
|
-
#
|
315
|
+
#
|
316
316
|
# ```ruby
|
317
317
|
# Proc.new {}.lambda? #=> false
|
318
318
|
# ```
|
319
|
-
#
|
319
|
+
#
|
320
320
|
# `lambda`, `proc` and [::new](Proc.downloaded.ruby_doc#method-c-new)
|
321
321
|
# preserve the tricks of a [Proc](Proc.downloaded.ruby_doc) object given
|
322
322
|
# by `&` argument.
|
323
|
-
#
|
323
|
+
#
|
324
324
|
# ```ruby
|
325
325
|
# lambda(&lambda {}).lambda? #=> true
|
326
326
|
# proc(&lambda {}).lambda? #=> true
|
327
327
|
# Proc.new(&lambda {}).lambda? #=> true
|
328
|
-
#
|
328
|
+
#
|
329
329
|
# lambda(&proc {}).lambda? #=> false
|
330
330
|
# proc(&proc {}).lambda? #=> false
|
331
331
|
# Proc.new(&proc {}).lambda? #=> false
|
332
332
|
# ```
|
333
|
-
#
|
333
|
+
#
|
334
334
|
# A [Proc](Proc.downloaded.ruby_doc) object generated by `&` argument has
|
335
335
|
# the tricks
|
336
|
-
#
|
336
|
+
#
|
337
337
|
# ```ruby
|
338
338
|
# def n(&b) b.lambda? end
|
339
339
|
# n {} #=> false
|
340
340
|
# ```
|
341
|
-
#
|
341
|
+
#
|
342
342
|
# The `&` argument preserves the tricks if a
|
343
343
|
# [Proc](Proc.downloaded.ruby_doc) object is given by `&` argument.
|
344
|
-
#
|
344
|
+
#
|
345
345
|
# ```ruby
|
346
346
|
# n(&lambda {}) #=> true
|
347
347
|
# n(&proc {}) #=> false
|
348
348
|
# n(&Proc.new {}) #=> false
|
349
349
|
# ```
|
350
|
-
#
|
350
|
+
#
|
351
351
|
# A [Proc](Proc.downloaded.ruby_doc) object converted from a method has no
|
352
352
|
# tricks.
|
353
|
-
#
|
353
|
+
#
|
354
354
|
# ```ruby
|
355
355
|
# def m() end
|
356
356
|
# method(:m).to_proc.lambda? #=> true
|
357
|
-
#
|
357
|
+
#
|
358
358
|
# n(&method(:m)) #=> true
|
359
359
|
# n(&method(:m).to_proc) #=> true
|
360
360
|
# ```
|
361
|
-
#
|
361
|
+
#
|
362
362
|
# `define_method` is treated the same as method definition. The defined
|
363
363
|
# method has no tricks.
|
364
|
-
#
|
364
|
+
#
|
365
365
|
# ```ruby
|
366
366
|
# class C
|
367
367
|
# define_method(:d) {}
|
@@ -369,11 +369,11 @@ class Proc < Object
|
|
369
369
|
# C.new.d(1,2) #=> ArgumentError
|
370
370
|
# C.new.method(:d).to_proc.lambda? #=> true
|
371
371
|
# ```
|
372
|
-
#
|
372
|
+
#
|
373
373
|
# `define_method` always defines a method without the tricks, even if a
|
374
374
|
# non-lambda [Proc](Proc.downloaded.ruby_doc) object is given. This is the
|
375
375
|
# only exception for which the tricks are not preserved.
|
376
|
-
#
|
376
|
+
#
|
377
377
|
# ```ruby
|
378
378
|
# class C
|
379
379
|
# define_method(:e, &proc {})
|
@@ -381,26 +381,26 @@ class Proc < Object
|
|
381
381
|
# C.new.e(1,2) #=> ArgumentError
|
382
382
|
# C.new.method(:e).to_proc.lambda? #=> true
|
383
383
|
# ```
|
384
|
-
#
|
384
|
+
#
|
385
385
|
# This exception ensures that methods never have tricks and makes it easy
|
386
386
|
# to have wrappers to define methods that behave as usual.
|
387
|
-
#
|
387
|
+
#
|
388
388
|
# ```ruby
|
389
389
|
# class C
|
390
390
|
# def self.def2(name, &body)
|
391
391
|
# define_method(name, &body)
|
392
392
|
# end
|
393
|
-
#
|
393
|
+
#
|
394
394
|
# def2(:f) {}
|
395
395
|
# end
|
396
396
|
# C.new.f(1,2) #=> ArgumentError
|
397
397
|
# ```
|
398
|
-
#
|
398
|
+
#
|
399
399
|
# The wrapper *def2* defines a method which has no tricks.
|
400
400
|
def lambda?: () -> bool
|
401
401
|
|
402
402
|
# Returns the parameter information of this proc.
|
403
|
-
#
|
403
|
+
#
|
404
404
|
# ```ruby
|
405
405
|
# prc = lambda{|x, y=42, *other|}
|
406
406
|
# prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]]
|
@@ -417,9 +417,9 @@ class Proc < Object
|
|
417
417
|
|
418
418
|
# Returns the unique identifier for this proc, along with an indication of
|
419
419
|
# where the proc was defined.
|
420
|
-
#
|
421
|
-
#
|
422
|
-
#
|
420
|
+
#
|
421
|
+
#
|
422
|
+
#
|
423
423
|
# Also aliased as: [inspect](Proc.downloaded.ruby_doc#method-i-inspect)
|
424
424
|
def to_s: () -> String
|
425
425
|
|