rbs 2.0.0 → 2.2.2

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.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +34 -0
  3. data/.github/workflows/ruby.yml +5 -0
  4. data/CHANGELOG.md +82 -0
  5. data/README.md +6 -1
  6. data/Rakefile +56 -21
  7. data/core/array.rbs +2866 -1086
  8. data/core/basic_object.rbs +150 -30
  9. data/core/binding.rbs +33 -0
  10. data/core/builtin.rbs +4 -4
  11. data/core/class.rbs +43 -5
  12. data/core/comparable.rbs +57 -0
  13. data/core/complex.rbs +170 -4
  14. data/core/constants.rbs +51 -0
  15. data/core/deprecated.rbs +7 -0
  16. data/core/dir.rbs +305 -20
  17. data/core/encoding.rbs +1214 -77
  18. data/core/enumerable.rbs +2173 -234
  19. data/core/enumerator.rbs +448 -182
  20. data/core/env.rbs +448 -1
  21. data/core/errno.rbs +1 -10
  22. data/core/errors.rbs +152 -2
  23. data/core/exception.rbs +201 -127
  24. data/core/false_class.rbs +27 -0
  25. data/core/fiber.rbs +118 -37
  26. data/core/fiber_error.rbs +8 -9
  27. data/core/file.rbs +1060 -142
  28. data/core/file_test.rbs +287 -32
  29. data/core/float.rbs +776 -300
  30. data/core/gc.rbs +185 -34
  31. data/core/global_variables.rbs +5 -1
  32. data/core/hash.rbs +1582 -649
  33. data/core/integer.rbs +974 -204
  34. data/core/io/buffer.rbs +710 -0
  35. data/core/io/wait.rbs +29 -8
  36. data/core/io.rbs +2438 -417
  37. data/core/kernel.rbs +2319 -318
  38. data/core/marshal.rbs +37 -2
  39. data/core/match_data.rbs +123 -6
  40. data/core/math.rbs +126 -6
  41. data/core/method.rbs +226 -102
  42. data/core/module.rbs +421 -45
  43. data/core/nil_class.rbs +64 -0
  44. data/core/numeric.rbs +620 -142
  45. data/core/object.rbs +453 -81
  46. data/core/object_space.rbs +92 -2
  47. data/core/proc.rbs +482 -285
  48. data/core/process.rbs +443 -34
  49. data/core/ractor.rbs +232 -9
  50. data/core/random.rbs +151 -52
  51. data/core/range.rbs +885 -160
  52. data/core/rational.rbs +122 -6
  53. data/core/rb_config.rbs +14 -4
  54. data/core/refinement.rbs +44 -0
  55. data/core/regexp.rbs +156 -14
  56. data/core/ruby_vm.rbs +42 -3
  57. data/core/signal.rbs +78 -39
  58. data/core/string.rbs +2123 -567
  59. data/core/string_io.rbs +204 -0
  60. data/core/struct.rbs +283 -28
  61. data/core/symbol.rbs +304 -30
  62. data/core/thread.rbs +1288 -688
  63. data/core/thread_group.rbs +66 -10
  64. data/core/time.rbs +643 -217
  65. data/core/trace_point.rbs +100 -12
  66. data/core/true_class.rbs +24 -0
  67. data/core/unbound_method.rbs +73 -7
  68. data/core/warning.rbs +37 -12
  69. data/docs/CONTRIBUTING.md +40 -34
  70. data/docs/stdlib.md +3 -102
  71. data/docs/syntax.md +54 -11
  72. data/ext/rbs_extension/extconf.rb +1 -0
  73. data/ext/rbs_extension/lexer.h +5 -0
  74. data/ext/rbs_extension/lexstate.c +6 -0
  75. data/ext/rbs_extension/parser.c +85 -10
  76. data/ext/rbs_extension/ruby_objs.c +4 -2
  77. data/ext/rbs_extension/ruby_objs.h +2 -2
  78. data/goodcheck.yml +0 -11
  79. data/lib/rbs/annotate/annotations.rb +197 -0
  80. data/lib/rbs/annotate/formatter.rb +80 -0
  81. data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
  82. data/lib/rbs/annotate/rdoc_source.rb +120 -0
  83. data/lib/rbs/annotate.rb +6 -0
  84. data/lib/rbs/ast/members.rb +21 -13
  85. data/lib/rbs/buffer.rb +17 -11
  86. data/lib/rbs/cli.rb +48 -1
  87. data/lib/rbs/definition_builder/method_builder.rb +28 -16
  88. data/lib/rbs/definition_builder.rb +6 -2
  89. data/lib/rbs/environment.rb +8 -4
  90. data/lib/rbs/location_aux.rb +12 -0
  91. data/lib/rbs/namespace.rb +1 -1
  92. data/lib/rbs/prototype/rb.rb +12 -0
  93. data/lib/rbs/type_alias_regularity.rb +6 -4
  94. data/lib/rbs/type_name.rb +1 -1
  95. data/lib/rbs/types.rb +1 -1
  96. data/lib/rbs/validator.rb +6 -0
  97. data/lib/rbs/version.rb +1 -1
  98. data/lib/rbs/writer.rb +54 -4
  99. data/lib/rbs.rb +0 -2
  100. data/schema/typeParam.json +3 -3
  101. data/sig/annotate/annotations.rbs +102 -0
  102. data/sig/annotate/formatter.rbs +24 -0
  103. data/sig/annotate/rdoc_annotater.rbs +82 -0
  104. data/sig/annotate/rdoc_source.rbs +30 -0
  105. data/sig/buffer.rbs +6 -2
  106. data/sig/cli.rbs +2 -0
  107. data/sig/collection/{collections.rbs → sources.rbs} +0 -0
  108. data/sig/location.rbs +6 -0
  109. data/sig/members.rbs +24 -18
  110. data/sig/method_builder.rbs +5 -4
  111. data/sig/method_types.rbs +5 -1
  112. data/sig/polyfill.rbs +78 -0
  113. data/sig/validator.rbs +3 -1
  114. data/sig/writer.rbs +79 -2
  115. data/stdlib/abbrev/0/abbrev.rbs +6 -0
  116. data/stdlib/abbrev/0/array.rbs +26 -0
  117. data/stdlib/base64/0/base64.rbs +31 -0
  118. data/stdlib/benchmark/0/benchmark.rbs +74 -3
  119. data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
  120. data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
  121. data/stdlib/cgi/0/core.rbs +649 -21
  122. data/stdlib/coverage/0/coverage.rbs +164 -2
  123. data/stdlib/csv/0/csv.rbs +2862 -398
  124. data/stdlib/date/0/date.rbs +483 -25
  125. data/stdlib/date/0/date_time.rbs +187 -12
  126. data/stdlib/dbm/0/dbm.rbs +152 -17
  127. data/stdlib/digest/0/digest.rbs +146 -0
  128. data/stdlib/erb/0/erb.rbs +65 -245
  129. data/stdlib/fiber/0/fiber.rbs +73 -91
  130. data/stdlib/fileutils/0/fileutils.rbs +301 -1
  131. data/stdlib/find/0/find.rbs +9 -0
  132. data/stdlib/forwardable/0/forwardable.rbs +65 -1
  133. data/stdlib/io-console/0/io-console.rbs +227 -15
  134. data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
  135. data/stdlib/json/0/json.rbs +1147 -145
  136. data/stdlib/logger/0/formatter.rbs +24 -0
  137. data/stdlib/logger/0/log_device.rbs +64 -0
  138. data/stdlib/logger/0/logger.rbs +165 -13
  139. data/stdlib/logger/0/period.rbs +10 -0
  140. data/stdlib/logger/0/severity.rbs +26 -0
  141. data/stdlib/monitor/0/monitor.rbs +163 -0
  142. data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
  143. data/stdlib/net-http/0/manifest.yaml +1 -0
  144. data/stdlib/net-http/0/net-http.rbs +1513 -683
  145. data/stdlib/nkf/0/nkf.rbs +372 -0
  146. data/stdlib/objspace/0/objspace.rbs +149 -90
  147. data/stdlib/openssl/0/openssl.rbs +8108 -71
  148. data/stdlib/optparse/0/optparse.rbs +487 -19
  149. data/stdlib/pathname/0/pathname.rbs +425 -124
  150. data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
  151. data/stdlib/prime/0/integer-extension.rbs +20 -2
  152. data/stdlib/prime/0/prime.rbs +88 -21
  153. data/stdlib/pstore/0/pstore.rbs +102 -0
  154. data/stdlib/pty/0/pty.rbs +64 -14
  155. data/stdlib/resolv/0/resolv.rbs +420 -31
  156. data/stdlib/rubygems/0/basic_specification.rbs +4 -1
  157. data/stdlib/rubygems/0/config_file.rbs +33 -1
  158. data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
  159. data/stdlib/rubygems/0/installer.rbs +13 -1
  160. data/stdlib/rubygems/0/path_support.rbs +4 -1
  161. data/stdlib/rubygems/0/platform.rbs +5 -1
  162. data/stdlib/rubygems/0/request_set.rbs +44 -2
  163. data/stdlib/rubygems/0/requirement.rbs +65 -2
  164. data/stdlib/rubygems/0/rubygems.rbs +407 -0
  165. data/stdlib/rubygems/0/source_list.rbs +13 -0
  166. data/stdlib/rubygems/0/specification.rbs +21 -1
  167. data/stdlib/rubygems/0/stream_ui.rbs +3 -1
  168. data/stdlib/rubygems/0/uninstaller.rbs +8 -1
  169. data/stdlib/rubygems/0/version.rbs +60 -157
  170. data/stdlib/securerandom/0/securerandom.rbs +44 -0
  171. data/stdlib/set/0/set.rbs +423 -109
  172. data/stdlib/shellwords/0/shellwords.rbs +55 -77
  173. data/stdlib/singleton/0/singleton.rbs +20 -0
  174. data/stdlib/socket/0/addrinfo.rbs +210 -9
  175. data/stdlib/socket/0/basic_socket.rbs +103 -11
  176. data/stdlib/socket/0/ip_socket.rbs +31 -9
  177. data/stdlib/socket/0/socket.rbs +586 -38
  178. data/stdlib/socket/0/tcp_server.rbs +22 -2
  179. data/stdlib/socket/0/tcp_socket.rbs +12 -1
  180. data/stdlib/socket/0/udp_socket.rbs +25 -2
  181. data/stdlib/socket/0/unix_server.rbs +22 -2
  182. data/stdlib/socket/0/unix_socket.rbs +45 -5
  183. data/stdlib/strscan/0/string_scanner.rbs +210 -9
  184. data/stdlib/tempfile/0/tempfile.rbs +58 -10
  185. data/stdlib/time/0/time.rbs +208 -116
  186. data/stdlib/timeout/0/timeout.rbs +10 -0
  187. data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
  188. data/stdlib/tsort/0/cyclic.rbs +1 -0
  189. data/stdlib/tsort/0/interfaces.rbs +1 -0
  190. data/stdlib/tsort/0/tsort.rbs +42 -0
  191. data/stdlib/uri/0/common.rbs +57 -8
  192. data/stdlib/uri/0/file.rbs +55 -109
  193. data/stdlib/uri/0/ftp.rbs +6 -3
  194. data/stdlib/uri/0/generic.rbs +558 -329
  195. data/stdlib/uri/0/http.rbs +60 -114
  196. data/stdlib/uri/0/https.rbs +8 -102
  197. data/stdlib/uri/0/ldap.rbs +143 -137
  198. data/stdlib/uri/0/ldaps.rbs +8 -102
  199. data/stdlib/uri/0/mailto.rbs +3 -0
  200. data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
  201. data/stdlib/uri/0/ws.rbs +6 -3
  202. data/stdlib/uri/0/wss.rbs +5 -3
  203. data/stdlib/yaml/0/dbm.rbs +151 -87
  204. data/stdlib/yaml/0/store.rbs +6 -0
  205. data/stdlib/zlib/0/zlib.rbs +90 -31
  206. metadata +18 -6
  207. data/lib/rbs/location.rb +0 -221
  208. data/sig/char_scanner.rbs +0 -9
data/core/object.rbs CHANGED
@@ -1,3 +1,4 @@
1
+ # <!-- rdoc-file=object.c -->
1
2
  # Object is the default root of all Ruby objects. Object inherits from
2
3
  # BasicObject which allows creating alternate object hierarchies. Methods on
3
4
  # Object are available to all classes unless explicitly overridden.
@@ -13,39 +14,216 @@
13
14
  # In the descriptions of Object's methods, the parameter *symbol* refers to a
14
15
  # symbol, which is either a quoted string or a Symbol (such as `:name`).
15
16
  #
17
+ # ## What's Here
18
+ #
19
+ # First, what's elsewhere. Class Object:
20
+ #
21
+ # * Inherits from [class
22
+ # BasicObject](BasicObject.html#class-BasicObject-label-What-27s+Here).
23
+ # * Includes [module Kernel](Kernel.html#module-Kernel-label-What-27s+Here).
24
+ #
25
+ #
26
+ # Here, class Object provides methods for:
27
+ #
28
+ # * [Querying](#class-Object-label-Querying)
29
+ # * [Instance Variables](#class-Object-label-Instance+Variables)
30
+ # * [Other](#class-Object-label-Other)
31
+ #
32
+ #
33
+ # ### Querying
34
+ #
35
+ # [!~](#method-i-21~)
36
+ # : Returns `true` if `self` does not match the given object, otherwise
37
+ # `false`.
38
+ #
39
+ # [<=>](#method-i-3C-3D-3E)
40
+ # : Returns 0 if `self` and the given object `object` are the same object,
41
+ # or if `self == object`; otherwise returns `nil`.
42
+ #
43
+ # #===
44
+ # : Implements case equality, effectively the same as calling #==.
45
+ #
46
+ # #eql?
47
+ # : Implements hash equality, effectively the same as calling #==.
48
+ #
49
+ # #kind_of? (aliased as #is_a?)
50
+ # : Returns whether given argument is an ancestor of the singleton class
51
+ # of `self`.
52
+ #
53
+ # #instance_of?
54
+ # : Returns whether `self` is an instance of the given class.
55
+ #
56
+ # #instance_variable_defined?
57
+ # : Returns whether the given instance variable is defined in `self`.
58
+ #
59
+ # #method
60
+ # : Returns the Method object for the given method in `self`.
61
+ #
62
+ # #methods
63
+ # : Returns an array of symbol names of public and protected methods in
64
+ # `self`.
65
+ #
66
+ # #nil?
67
+ # : Returns `false`. (Only `nil` responds `true` to method `nil?`.)
68
+ #
69
+ # #object_id
70
+ # : Returns an integer corresponding to `self` that is unique for the
71
+ # current process
72
+ #
73
+ # #private_methods
74
+ # : Returns an array of the symbol names of the private methods in `self`.
75
+ #
76
+ # #protected_methods
77
+ # : Returns an array of the symbol names of the protected methods in
78
+ # `self`.
79
+ #
80
+ # #public_method
81
+ # : Returns the Method object for the given public method in `self`.
82
+ #
83
+ # #public_methods
84
+ # : Returns an array of the symbol names of the public methods in `self`.
85
+ #
86
+ # #respond_to?
87
+ # : Returns whether `self` responds to the given method.
88
+ #
89
+ # #singleton_class
90
+ # : Returns the singleton class of `self`.
91
+ #
92
+ # #singleton_method
93
+ # : Returns the Method object for the given singleton method in `self`.
94
+ #
95
+ # #singleton_methods
96
+ # : Returns an array of the symbol names of the singleton methods in
97
+ # `self`.
98
+ #
99
+ #
100
+ # #define_singleton_method
101
+ # : Defines a singleton method in `self` for the given symbol method-name
102
+ # and block or proc.
103
+ #
104
+ # #extend
105
+ # : Includes the given modules in the singleton class of `self`.
106
+ #
107
+ # #public_send
108
+ # : Calls the given public method in `self` with the given argument.
109
+ #
110
+ # #send
111
+ # : Calls the given method in `self` with the given argument.
112
+ #
113
+ #
114
+ #
115
+ # ### Instance Variables
116
+ #
117
+ # #instance_variable_get
118
+ # : Returns the value of the given instance variable in `self`, or `nil`
119
+ # if the instance variable is not set.
120
+ #
121
+ # #instance_variable_set
122
+ # : Sets the value of the given instance variable in `self` to the given
123
+ # object.
124
+ #
125
+ # #instance_variables
126
+ # : Returns an array of the symbol names of the instance variables in
127
+ # `self`.
128
+ #
129
+ # #remove_instance_variable
130
+ # : Removes the named instance variable from `self`.
131
+ #
132
+ #
133
+ #
134
+ # ### Other
135
+ #
136
+ # #clone
137
+ # : Returns a shallow copy of `self`, including singleton class and frozen
138
+ # state.
139
+ #
140
+ # #define_singleton_method
141
+ # : Defines a singleton method in `self` for the given symbol method-name
142
+ # and block or proc.
143
+ #
144
+ # #display
145
+ # : Prints `self` to the given IO stream or `$stdout`.
146
+ #
147
+ # #dup
148
+ # : Returns a shallow unfrozen copy of `self`.
149
+ #
150
+ # #enum_for (aliased as #to_enum)
151
+ # : Returns an Enumerator for `self` using the using the given method,
152
+ # arguments, and block.
153
+ #
154
+ # #extend
155
+ # : Includes the given modules in the singleton class of `self`.
156
+ #
157
+ # #freeze
158
+ # : Prevents further modifications to `self`.
159
+ #
160
+ # #hash
161
+ # : Returns the integer hash value for `self`.
162
+ #
163
+ # #inspect
164
+ # : Returns a human-readable string representation of `self`.
165
+ #
166
+ # #itself
167
+ # : Returns `self`.
168
+ #
169
+ # #public_send
170
+ # : Calls the given public method in `self` with the given argument.
171
+ #
172
+ # #send
173
+ # : Calls the given method in `self` with the given argument.
174
+ #
175
+ # #to_s
176
+ # : Returns a string representation of `self`.
177
+ #
16
178
  class Object < BasicObject
17
179
  include Kernel
18
180
 
181
+ # <!--
182
+ # rdoc-file=object.c
183
+ # - obj !~ other -> true or false
184
+ # -->
19
185
  # Returns true if two objects do not match (using the *=~* method), otherwise
20
186
  # false.
21
187
  #
22
188
  def !~: (untyped) -> bool
23
189
 
190
+ # <!--
191
+ # rdoc-file=object.c
192
+ # - obj <=> other -> 0 or nil
193
+ # -->
24
194
  # Returns 0 if `obj` and `other` are the same object or `obj == other`,
25
195
  # otherwise nil.
26
196
  #
27
- # The `<=>` is used by various methods to compare objects, for example
197
+ # The #<=> is used by various methods to compare objects, for example
28
198
  # Enumerable#sort, Enumerable#max etc.
29
199
  #
30
- # Your implementation of `<=>` should return one of the following values: -1, 0,
200
+ # Your implementation of #<=> should return one of the following values: -1, 0,
31
201
  # 1 or nil. -1 means self is smaller than other. 0 means self is equal to other.
32
202
  # 1 means self is bigger than other. Nil means the two values could not be
33
203
  # compared.
34
204
  #
35
- # When you define `<=>`, you can include Comparable to gain the methods `<=`,
36
- # `<`, `==`, `>=`, `>` and `between?`.
205
+ # When you define #<=>, you can include Comparable to gain the methods #<=, #<,
206
+ # #==, #>=, #> and #between?.
37
207
  #
38
208
  def <=>: (untyped) -> Integer?
39
209
 
210
+ # <!--
211
+ # rdoc-file=object.c
212
+ # - obj === other -> true or false
213
+ # -->
40
214
  # Case Equality -- For class Object, effectively the same as calling `#==`, but
41
215
  # typically overridden by descendants to provide meaningful semantics in `case`
42
216
  # statements.
43
217
  #
44
218
  def ===: (untyped) -> bool
45
219
 
220
+ # <!--
221
+ # rdoc-file=object.c
222
+ # - obj =~ other -> nil
223
+ # -->
46
224
  # This method is deprecated.
47
225
  #
48
- # This is not only unuseful but also troublesome because it may hide a type
226
+ # This is not only useless but also troublesome because it may hide a type
49
227
  # error.
50
228
  #
51
229
  def =~: (untyped) -> bool
@@ -56,7 +234,7 @@ class Object < BasicObject
56
234
  # 1.class #=> Integer
57
235
  # self.class #=> Object
58
236
  #
59
- def `class`: () -> untyped
237
+ def class: () -> untyped
60
238
 
61
239
  # Produces a shallow copy of *obj*---the instance variables of *obj* are copied,
62
240
  # but not the objects they reference. `clone` copies the frozen (unless :freeze
@@ -78,9 +256,15 @@ class Object < BasicObject
78
256
  #
79
257
  def clone: (?freeze: bool?) -> self
80
258
 
259
+ # <!--
260
+ # rdoc-file=proc.c
261
+ # - define_singleton_method(symbol, method) -> symbol
262
+ # - define_singleton_method(symbol) { block } -> symbol
263
+ # -->
81
264
  # Defines a singleton method in the receiver. The *method* parameter can be a
82
265
  # `Proc`, a `Method` or an `UnboundMethod` object. If a block is specified, it
83
- # is used as the method body.
266
+ # is used as the method body. If a block or a method has parameters, they're
267
+ # used as method parameters.
84
268
  #
85
269
  # class A
86
270
  # class << self
@@ -98,9 +282,17 @@ class Object < BasicObject
98
282
  # guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
99
283
  # guy.hello #=> "Bob: Hello there!"
100
284
  #
285
+ # chris = "Chris"
286
+ # chris.define_singleton_method(:greet) {|greeting| "#{greeting}, I'm Chris!" }
287
+ # chris.greet("Hi") #=> "Hi, I'm Chris!"
288
+ #
101
289
  def define_singleton_method: (Symbol, Method | UnboundMethod) -> Symbol
102
290
  | (Symbol) { (*untyped) -> untyped } -> Symbol
103
291
 
292
+ # <!--
293
+ # rdoc-file=io.c
294
+ # - obj.display(port=$>) -> nil
295
+ # -->
104
296
  # Prints *obj* on the given port (default `$>`). Equivalent to:
105
297
  #
106
298
  # def display(port=$>)
@@ -121,17 +313,21 @@ class Object < BasicObject
121
313
  #
122
314
  def display: (?_Writeable port) -> void
123
315
 
316
+ # <!--
317
+ # rdoc-file=object.c
318
+ # - obj.dup -> an_object
319
+ # -->
124
320
  # Produces a shallow copy of *obj*---the instance variables of *obj* are copied,
125
- # but not the objects they reference. `dup` copies the tainted state of *obj*.
321
+ # but not the objects they reference.
126
322
  #
127
323
  # This method may have class-specific behavior. If so, that behavior will be
128
324
  # documented under the #`initialize_copy` method of the class.
129
325
  #
130
326
  # ### on dup vs clone
131
327
  #
132
- # In general, `clone` and `dup` may have different semantics in descendant
133
- # classes. While `clone` is used to duplicate an object, including its internal
134
- # state, `dup` typically uses the class of the descendant object to create the
328
+ # In general, #clone and #dup may have different semantics in descendant
329
+ # classes. While #clone is used to duplicate an object, including its internal
330
+ # state, #dup typically uses the class of the descendant object to create the
135
331
  # new instance.
136
332
  #
137
333
  # When using #dup, any modules that the object has been extended with will not
@@ -149,16 +345,18 @@ class Object < BasicObject
149
345
  # s1.extend(Foo) #=> #<Klass:0x401b3a38>
150
346
  # s1.foo #=> "foo"
151
347
  #
152
- # s2 = s1.clone #=> #<Klass:0x401b3a38>
348
+ # s2 = s1.clone #=> #<Klass:0x401be280>
153
349
  # s2.foo #=> "foo"
154
350
  #
155
- # s3 = s1.dup #=> #<Klass:0x401b3a38>
156
- # s3.foo #=> NoMethodError: undefined method `foo' for #<Klass:0x401b3a38>
351
+ # s3 = s1.dup #=> #<Klass:0x401c1084>
352
+ # s3.foo #=> NoMethodError: undefined method `foo' for #<Klass:0x401c1084>
157
353
  #
158
354
  def dup: () -> self
159
355
 
356
+ # <!-- rdoc-file=enumerator.c -->
160
357
  # Creates a new Enumerator which will enumerate by calling `method` on `obj`,
161
- # passing `args` if any.
358
+ # passing `args` if any. What was *yielded* by method becomes values of
359
+ # enumerator.
162
360
  #
163
361
  # If a block is given, it will be used to calculate the size of the enumerator
164
362
  # without the need to iterate it (see Enumerator#size).
@@ -177,6 +375,11 @@ class Object < BasicObject
177
375
  # a = [1, 2, 3]
178
376
  # some_method(a.to_enum)
179
377
  #
378
+ # # String#split in block form is more memory-effective:
379
+ # very_large_string.split("|") { |chunk| return chunk if chunk.include?('DATE') }
380
+ # # This could be rewritten more idiomatically with to_enum:
381
+ # very_large_string.to_enum(:split, "|").lazy.grep(/DATE/).first
382
+ #
180
383
  # It is typical to call to_enum when defining methods for a generic Enumerable,
181
384
  # in case no block is passed.
182
385
  #
@@ -208,8 +411,16 @@ class Object < BasicObject
208
411
  def enum_for: (Symbol method, *untyped args) ?{ (*untyped args) -> Integer } -> Enumerator[untyped, untyped]
209
412
  | () ?{ () -> Integer } -> Enumerator[untyped, self]
210
413
 
414
+ # <!--
415
+ # rdoc-file=enumerator.c
416
+ # - obj.to_enum(method = :each, *args) -> enum
417
+ # - obj.enum_for(method = :each, *args) -> enum
418
+ # - obj.to_enum(method = :each, *args) {|*args| block} -> enum
419
+ # - obj.enum_for(method = :each, *args){|*args| block} -> enum
420
+ # -->
211
421
  # Creates a new Enumerator which will enumerate by calling `method` on `obj`,
212
- # passing `args` if any.
422
+ # passing `args` if any. What was *yielded* by method becomes values of
423
+ # enumerator.
213
424
  #
214
425
  # If a block is given, it will be used to calculate the size of the enumerator
215
426
  # without the need to iterate it (see Enumerator#size).
@@ -228,6 +439,11 @@ class Object < BasicObject
228
439
  # a = [1, 2, 3]
229
440
  # some_method(a.to_enum)
230
441
  #
442
+ # # String#split in block form is more memory-effective:
443
+ # very_large_string.split("|") { |chunk| return chunk if chunk.include?('DATE') }
444
+ # # This could be rewritten more idiomatically with to_enum:
445
+ # very_large_string.to_enum(:split, "|").lazy.grep(/DATE/).first
446
+ #
231
447
  # It is typical to call to_enum when defining methods for a generic Enumerable,
232
448
  # in case no block is passed.
233
449
  #
@@ -258,12 +474,18 @@ class Object < BasicObject
258
474
  #
259
475
  alias to_enum enum_for
260
476
 
261
- # Equality --- At the `Object` level, `==` returns `true` only if `obj` and
262
- # `other` are the same object. Typically, this method is overridden in
263
- # descendant classes to provide class-specific meaning.
264
- #
265
- # Unlike `==`, the `equal?` method should never be overridden by subclasses as
266
- # it is used to determine object identity (that is, `a.equal?(b)` if and only if
477
+ # <!--
478
+ # rdoc-file=object.c
479
+ # - obj == other -> true or false
480
+ # - obj.equal?(other) -> true or false
481
+ # - obj.eql?(other) -> true or false
482
+ # -->
483
+ # Equality --- At the Object level, #== returns `true` only if `obj` and `other`
484
+ # are the same object. Typically, this method is overridden in descendant
485
+ # classes to provide class-specific meaning.
486
+ #
487
+ # Unlike #==, the #equal? method should never be overridden by subclasses as it
488
+ # is used to determine object identity (that is, `a.equal?(b)` if and only if
267
489
  # `a` is the same object as `b`):
268
490
  #
269
491
  # obj = "a"
@@ -273,18 +495,26 @@ class Object < BasicObject
273
495
  # obj.equal? other #=> false
274
496
  # obj.equal? obj #=> true
275
497
  #
276
- # The `eql?` method returns `true` if `obj` and `other` refer to the same hash
277
- # key. This is used by Hash to test members for equality. For objects of class
278
- # `Object`, `eql?` is synonymous with `==`. Subclasses normally continue this
279
- # tradition by aliasing `eql?` to their overridden `==` method, but there are
280
- # exceptions. `Numeric` types, for example, perform type conversion across
281
- # `==`, but not across `eql?`, so:
498
+ # The #eql? method returns `true` if `obj` and `other` refer to the same hash
499
+ # key. This is used by Hash to test members for equality. For any pair of
500
+ # objects where #eql? returns `true`, the #hash value of both objects must be
501
+ # equal. So any subclass that overrides #eql? should also override #hash
502
+ # appropriately.
503
+ #
504
+ # For objects of class Object, #eql? is synonymous with #==. Subclasses
505
+ # normally continue this tradition by aliasing #eql? to their overridden #==
506
+ # method, but there are exceptions. Numeric types, for example, perform type
507
+ # conversion across #==, but not across #eql?, so:
282
508
  #
283
509
  # 1 == 1.0 #=> true
284
510
  # 1.eql? 1.0 #=> false
285
511
  #
286
512
  def eql?: (untyped) -> bool
287
513
 
514
+ # <!--
515
+ # rdoc-file=eval.c
516
+ # - obj.extend(module, ...) -> obj
517
+ # -->
288
518
  # Adds to *obj* the instance methods from each module given as a parameter.
289
519
  #
290
520
  # module Mod
@@ -304,11 +534,15 @@ class Object < BasicObject
304
534
  # k.extend(Mod) #=> #<Klass:0x401b3bc8>
305
535
  # k.hello #=> "Hello from Mod.\n"
306
536
  #
307
- def `extend`: (*Module) -> self
537
+ def extend: (*Module) -> self
308
538
 
309
- # Prevents further modifications to *obj*. A `RuntimeError` will be raised if
539
+ # <!--
540
+ # rdoc-file=object.c
541
+ # - obj.freeze -> obj
542
+ # -->
543
+ # Prevents further modifications to *obj*. A FrozenError will be raised if
310
544
  # modification is attempted. There is no way to unfreeze a frozen object. See
311
- # also `Object#frozen?`.
545
+ # also Object#frozen?.
312
546
  #
313
547
  # This method returns self.
314
548
  #
@@ -333,14 +567,38 @@ class Object < BasicObject
333
567
  #
334
568
  def frozen?: () -> bool
335
569
 
570
+ # <!--
571
+ # rdoc-file=object.c
572
+ # - obj.hash -> integer
573
+ # -->
574
+ # Generates an Integer hash value for this object. This function must have the
575
+ # property that `a.eql?(b)` implies `a.hash == b.hash`.
576
+ #
577
+ # The hash value is used along with #eql? by the Hash class to determine if two
578
+ # objects reference the same hash key. Any hash value that exceeds the capacity
579
+ # of an Integer will be truncated before being used.
580
+ #
581
+ # The hash value for an object may not be identical across invocations or
582
+ # implementations of Ruby. If you need a stable identifier across Ruby
583
+ # invocations and implementations you will need to generate one with a custom
584
+ # method.
585
+ #
586
+ # Certain core classes such as Integer use built-in hash calculations and do not
587
+ # call the #hash method when used as a hash key.
588
+ #
336
589
  def hash: () -> Integer
337
590
 
591
+ # <!--
592
+ # rdoc-file=object.c
593
+ # - obj.inspect -> string
594
+ # -->
338
595
  # Returns a string containing a human-readable representation of *obj*. The
339
- # default `inspect` shows the object's class name, an encoding of the object id,
340
- # and a list of the instance variables and their values (by calling #inspect on
341
- # each of them). User defined classes should override this method to provide a
342
- # better representation of *obj*. When overriding this method, it should return
343
- # a string whose encoding is compatible with the default external encoding.
596
+ # default #inspect shows the object's class name, an encoding of its memory
597
+ # address, and a list of the instance variables and their values (by calling
598
+ # #inspect on each of them). User defined classes should override this method
599
+ # to provide a better representation of *obj*. When overriding this method, it
600
+ # should return a string whose encoding is compatible with the default external
601
+ # encoding.
344
602
  #
345
603
  # [ 1, 2, 3..4, 'five' ].inspect #=> "[1, 2, 3..4, \"five\"]"
346
604
  # Time.new.inspect #=> "2008-03-08 19:43:39 +0900"
@@ -358,8 +616,12 @@ class Object < BasicObject
358
616
  #
359
617
  def inspect: () -> String
360
618
 
619
+ # <!--
620
+ # rdoc-file=object.c
621
+ # - obj.instance_of?(class) -> true or false
622
+ # -->
361
623
  # Returns `true` if *obj* is an instance of the given class. See also
362
- # `Object#kind_of?`.
624
+ # Object#kind_of?.
363
625
  #
364
626
  # class A; end
365
627
  # class B < A; end
@@ -372,6 +634,11 @@ class Object < BasicObject
372
634
  #
373
635
  def instance_of?: (Module) -> bool
374
636
 
637
+ # <!--
638
+ # rdoc-file=object.c
639
+ # - obj.instance_variable_defined?(symbol) -> true or false
640
+ # - obj.instance_variable_defined?(string) -> true or false
641
+ # -->
375
642
  # Returns `true` if the given instance variable is defined in *obj*. String
376
643
  # arguments are converted to symbols.
377
644
  #
@@ -387,9 +654,14 @@ class Object < BasicObject
387
654
  #
388
655
  def instance_variable_defined?: (String | Symbol var) -> bool
389
656
 
657
+ # <!--
658
+ # rdoc-file=object.c
659
+ # - obj.instance_variable_get(symbol) -> obj
660
+ # - obj.instance_variable_get(string) -> obj
661
+ # -->
390
662
  # Returns the value of the given instance variable, or nil if the instance
391
663
  # variable is not set. The `@` part of the variable name should be included for
392
- # regular instance variables. Throws a `NameError` exception if the supplied
664
+ # regular instance variables. Throws a NameError exception if the supplied
393
665
  # symbol is not valid as an instance variable name. String arguments are
394
666
  # converted to symbols.
395
667
  #
@@ -404,11 +676,16 @@ class Object < BasicObject
404
676
  #
405
677
  def instance_variable_get: (String | Symbol var) -> untyped
406
678
 
407
- # Sets the instance variable named by *symbol* to the given object, thereby
408
- # frustrating the efforts of the class's author to attempt to provide proper
409
- # encapsulation. The variable does not have to exist prior to this call. If the
410
- # instance variable name is passed as a string, that string is converted to a
411
- # symbol.
679
+ # <!--
680
+ # rdoc-file=object.c
681
+ # - obj.instance_variable_set(symbol, obj) -> obj
682
+ # - obj.instance_variable_set(string, obj) -> obj
683
+ # -->
684
+ # Sets the instance variable named by *symbol* to the given object. This may
685
+ # circumvent the encapsulation intended by the author of the class, so it should
686
+ # be used with care. The variable does not have to exist prior to this call. If
687
+ # the instance variable name is passed as a string, that string is converted to
688
+ # a symbol.
412
689
  #
413
690
  # class Fred
414
691
  # def initialize(p1, p2)
@@ -422,6 +699,10 @@ class Object < BasicObject
422
699
  #
423
700
  def instance_variable_set: [X] (String | Symbol var, X value) -> X
424
701
 
702
+ # <!--
703
+ # rdoc-file=object.c
704
+ # - obj.instance_variables -> array
705
+ # -->
425
706
  # Returns an array of instance variable names for the receiver. Note that simply
426
707
  # defining an accessor does not create the corresponding instance variable.
427
708
  #
@@ -435,6 +716,7 @@ class Object < BasicObject
435
716
  #
436
717
  def instance_variables: () -> Array[Symbol]
437
718
 
719
+ # <!-- rdoc-file=object.c -->
438
720
  # Returns `true` if *class* is the class of *obj*, or if *class* is one of the
439
721
  # superclasses of *obj* or modules included in *obj*.
440
722
  #
@@ -458,6 +740,11 @@ class Object < BasicObject
458
740
  #
459
741
  def is_a?: (Module) -> bool
460
742
 
743
+ # <!--
744
+ # rdoc-file=object.c
745
+ # - obj.is_a?(class) -> true or false
746
+ # - obj.kind_of?(class) -> true or false
747
+ # -->
461
748
  # Returns `true` if *class* is the class of *obj*, or if *class* is one of the
462
749
  # superclasses of *obj* or modules included in *obj*.
463
750
  #
@@ -481,17 +768,24 @@ class Object < BasicObject
481
768
  #
482
769
  alias kind_of? is_a?
483
770
 
771
+ # <!--
772
+ # rdoc-file=object.c
773
+ # - obj.itself -> obj
774
+ # -->
484
775
  # Returns the receiver.
485
776
  #
486
777
  # string = "my string"
487
778
  # string.itself.object_id == string.object_id #=> true
488
779
  #
489
- def `itself`: () -> self
780
+ def itself: () -> self
490
781
 
491
- # Looks up the named method as a receiver in *obj*, returning a `Method` object
492
- # (or raising `NameError`). The `Method` object acts as a closure in *obj*'s
493
- # object instance, so instance variables and the value of `self` remain
494
- # available.
782
+ # <!--
783
+ # rdoc-file=proc.c
784
+ # - obj.method(sym) -> method
785
+ # -->
786
+ # Looks up the named method as a receiver in *obj*, returning a Method object
787
+ # (or raising NameError). The Method object acts as a closure in *obj*'s object
788
+ # instance, so instance variables and the value of `self` remain available.
495
789
  #
496
790
  # class Demo
497
791
  # def initialize(n)
@@ -510,8 +804,8 @@ class Object < BasicObject
510
804
  # m = l.method("hello")
511
805
  # m.call #=> "Hello, @iv = Fred"
512
806
  #
513
- # Note that `Method` implements `to_proc` method, which means it can be used
514
- # with iterators.
807
+ # Note that Method implements `to_proc` method, which means it can be used with
808
+ # iterators.
515
809
  #
516
810
  # [ 1, 2, 3 ].each(&method(:puts)) # => prints 3 lines to stdout
517
811
  #
@@ -524,11 +818,15 @@ class Object < BasicObject
524
818
  #
525
819
  def method: (String | Symbol name) -> Method
526
820
 
821
+ # <!--
822
+ # rdoc-file=object.c
823
+ # - obj.methods(regular=true) -> array
824
+ # -->
527
825
  # Returns a list of the names of public and protected methods of *obj*. This
528
826
  # will include all the methods accessible in *obj*'s ancestors. If the optional
529
- # parameter is `false`, it returns an array of *obj<i>'s public and protected
827
+ # parameter is `false`, it returns an array of *obj*'s public and protected
530
828
  # singleton methods, the array will not include methods in modules included in
531
- # <i>obj*.
829
+ # *obj*.
532
830
  #
533
831
  # class Klass
534
832
  # def klass_method()
@@ -550,13 +848,22 @@ class Object < BasicObject
550
848
  #
551
849
  def methods: () -> Array[Symbol]
552
850
 
851
+ # <!--
852
+ # rdoc-file=object.c
853
+ # - obj.nil? -> true or false
854
+ # -->
553
855
  # Only the object *nil* responds `true` to `nil?`.
554
856
  #
555
857
  # Object.new.nil? #=> false
556
858
  # nil.nil? #=> true
557
859
  #
558
- def `nil?`: () -> bool
860
+ def nil?: () -> bool
559
861
 
862
+ # <!--
863
+ # rdoc-file=gc.c
864
+ # - obj.__id__ -> integer
865
+ # - obj.object_id -> integer
866
+ # -->
560
867
  # Returns an integer identifier for `obj`.
561
868
  #
562
869
  # The same number will be returned on all calls to `object_id` for a given
@@ -565,6 +872,8 @@ class Object < BasicObject
565
872
  # Note: that some objects of builtin classes are reused for optimization. This
566
873
  # is the case for immediate values and frozen string literals.
567
874
  #
875
+ # BasicObject implements +__id__+, Kernel implements `object_id`.
876
+ #
568
877
  # Immediate values are not passed by reference but are passed by value: `nil`,
569
878
  # `true`, `false`, Fixnums, Symbols, and some Floats.
570
879
  #
@@ -575,30 +884,52 @@ class Object < BasicObject
575
884
  #
576
885
  def object_id: () -> Integer
577
886
 
887
+ # <!--
888
+ # rdoc-file=object.c
889
+ # - obj.private_methods(all=true) -> array
890
+ # -->
578
891
  # Returns the list of private methods accessible to *obj*. If the *all*
579
892
  # parameter is set to `false`, only those methods in the receiver will be
580
893
  # listed.
581
894
  #
582
895
  def private_methods: () -> Array[Symbol]
583
896
 
897
+ # <!--
898
+ # rdoc-file=object.c
899
+ # - obj.protected_methods(all=true) -> array
900
+ # -->
584
901
  # Returns the list of protected methods accessible to *obj*. If the *all*
585
902
  # parameter is set to `false`, only those methods in the receiver will be
586
903
  # listed.
587
904
  #
588
905
  def protected_methods: () -> Array[Symbol]
589
906
 
907
+ # <!--
908
+ # rdoc-file=proc.c
909
+ # - obj.public_method(sym) -> method
910
+ # -->
590
911
  # Similar to *method*, searches public method only.
591
912
  #
592
913
  def public_method: (name name) -> Method
593
914
 
915
+ # <!--
916
+ # rdoc-file=vm_eval.c
917
+ # - obj.public_send(symbol [, args...]) -> obj
918
+ # - obj.public_send(string [, args...]) -> obj
919
+ # -->
594
920
  # Invokes the method identified by *symbol*, passing it any arguments specified.
595
921
  # Unlike send, public_send calls public methods only. When the method is
596
922
  # identified by a string, the string is converted to a symbol.
597
923
  #
598
924
  # 1.public_send(:puts, "hello") # causes NoMethodError
599
925
  #
600
- def `public_send`: (name name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
926
+ def public_send: (name name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
601
927
 
928
+ # <!--
929
+ # rdoc-file=object.c
930
+ # - obj.remove_instance_variable(symbol) -> obj
931
+ # - obj.remove_instance_variable(string) -> obj
932
+ # -->
602
933
  # Removes the named instance variable from *obj*, returning that variable's
603
934
  # value. String arguments are converted to symbols.
604
935
  #
@@ -618,6 +949,11 @@ class Object < BasicObject
618
949
  #
619
950
  def remove_instance_variable: (name name) -> untyped
620
951
 
952
+ # <!--
953
+ # rdoc-file=vm_method.c
954
+ # - obj.respond_to?(symbol, include_all=false) -> true or false
955
+ # - obj.respond_to?(string, include_all=false) -> true or false
956
+ # -->
621
957
  # Returns `true` if *obj* responds to the given method. Private and protected
622
958
  # methods are included in the search only if the optional second parameter
623
959
  # evaluates to `true`.
@@ -633,11 +969,21 @@ class Object < BasicObject
633
969
  #
634
970
  def respond_to?: (name name, ?boolish include_all) -> bool
635
971
 
972
+ # <!--
973
+ # rdoc-file=vm_eval.c
974
+ # - foo.send(symbol [, args...]) -> obj
975
+ # - foo.__send__(symbol [, args...]) -> obj
976
+ # - foo.send(string [, args...]) -> obj
977
+ # - foo.__send__(string [, args...]) -> obj
978
+ # -->
636
979
  # Invokes the method identified by *symbol*, passing it any arguments specified.
637
- # You can use `__send__` if the name `send` clashes with an existing method in
638
- # *obj*. When the method is identified by a string, the string is converted to a
980
+ # When the method is identified by a string, the string is converted to a
639
981
  # symbol.
640
982
  #
983
+ # BasicObject implements +__send__+, Kernel implements `send`. `__send__` is
984
+ # safer than `send` when *obj* has the same method name like `Socket`. See also
985
+ # `public_send`.
986
+ #
641
987
  # class Klass
642
988
  # def hello(*args)
643
989
  # "Hello " + args.join(' ')
@@ -646,8 +992,12 @@ class Object < BasicObject
646
992
  # k = Klass.new
647
993
  # k.send :hello, "gentle", "readers" #=> "Hello gentle readers"
648
994
  #
649
- def `send`: (name name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
995
+ def send: (name name, *untyped args) ?{ (*untyped) -> untyped } -> untyped
650
996
 
997
+ # <!--
998
+ # rdoc-file=object.c
999
+ # - obj.singleton_class -> class
1000
+ # -->
651
1001
  # Returns the singleton class of *obj*. This method creates a new singleton
652
1002
  # class if *obj* does not have one.
653
1003
  #
@@ -659,8 +1009,12 @@ class Object < BasicObject
659
1009
  # String.singleton_class #=> #<Class:String>
660
1010
  # nil.singleton_class #=> NilClass
661
1011
  #
662
- def `singleton_class`: () -> Class
1012
+ def singleton_class: () -> Class
663
1013
 
1014
+ # <!--
1015
+ # rdoc-file=proc.c
1016
+ # - obj.singleton_method(sym) -> method
1017
+ # -->
664
1018
  # Similar to *method*, searches singleton method only.
665
1019
  #
666
1020
  # class Demo
@@ -682,6 +1036,10 @@ class Object < BasicObject
682
1036
  #
683
1037
  def singleton_method: (name name) -> Method
684
1038
 
1039
+ # <!--
1040
+ # rdoc-file=object.c
1041
+ # - obj.singleton_methods(all=true) -> array
1042
+ # -->
685
1043
  # Returns an array of the names of singleton methods for *obj*. If the optional
686
1044
  # *all* parameter is true, the list will include methods in modules included in
687
1045
  # *obj*. Only public and protected singleton methods are returned.
@@ -711,31 +1069,35 @@ class Object < BasicObject
711
1069
  #
712
1070
  def singleton_methods: () -> Array[Symbol]
713
1071
 
714
- # Mark the object as tainted.
715
- #
716
- # Objects that are marked as tainted will be restricted from various built-in
717
- # methods. This is to prevent insecure data, such as command-line arguments or
718
- # strings read from Kernel#gets, from inadvertently compromising the user's
719
- # system.
720
- #
721
- # To check whether an object is tainted, use #tainted?.
722
- #
723
- # You should only untaint a tainted object if your code has inspected it and
724
- # determined that it is safe. To do so use #untaint.
1072
+ # <!--
1073
+ # rdoc-file=object.c
1074
+ # - obj.taint -> obj
1075
+ # -->
1076
+ # Returns object. This method is deprecated and will be removed in Ruby 3.2.
725
1077
  #
726
1078
  def taint: () -> self
727
1079
 
728
- # Deprecated method that is equivalent to #taint.
1080
+ # <!--
1081
+ # rdoc-file=object.c
1082
+ # - obj.untrust -> obj
1083
+ # -->
1084
+ # Returns object. This method is deprecated and will be removed in Ruby 3.2.
729
1085
  #
730
1086
  alias untrust taint
731
1087
 
732
- # Returns true if the object is tainted.
733
- #
734
- # See #taint for more information.
1088
+ # <!--
1089
+ # rdoc-file=object.c
1090
+ # - obj.tainted? -> false
1091
+ # -->
1092
+ # Returns false. This method is deprecated and will be removed in Ruby 3.2.
735
1093
  #
736
1094
  def tainted?: () -> bool
737
1095
 
738
- # Deprecated method that is equivalent to #tainted?.
1096
+ # <!--
1097
+ # rdoc-file=object.c
1098
+ # - obj.untrusted? -> false
1099
+ # -->
1100
+ # Returns false. This method is deprecated and will be removed in Ruby 3.2.
739
1101
  #
740
1102
  alias untrusted? tainted?
741
1103
 
@@ -772,23 +1134,33 @@ class Object < BasicObject
772
1134
  # # does not meet condition, drop value
773
1135
  # 2.yield_self.detect(&:odd?) # => nil
774
1136
  #
775
- def `yield_self`: [X] () { (self) -> X } -> X
776
- | () -> Enumerator[self, untyped]
1137
+ def yield_self: [X] () { (self) -> X } -> X
1138
+ | () -> Enumerator[self, untyped]
777
1139
 
778
- # Returns a string representing *obj*. The default `to_s` prints the object's
1140
+ # <!--
1141
+ # rdoc-file=object.c
1142
+ # - obj.to_s -> string
1143
+ # -->
1144
+ # Returns a string representing *obj*. The default #to_s prints the object's
779
1145
  # class and an encoding of the object id. As a special case, the top-level
780
1146
  # object that is the initial execution context of Ruby programs returns
781
1147
  # ``main''.
782
1148
  #
783
1149
  def to_s: () -> String
784
1150
 
785
- # Removes the tainted mark from the object.
786
- #
787
- # See #taint for more information.
1151
+ # <!--
1152
+ # rdoc-file=object.c
1153
+ # - obj.untaint -> obj
1154
+ # -->
1155
+ # Returns object. This method is deprecated and will be removed in Ruby 3.2.
788
1156
  #
789
1157
  def untaint: () -> self
790
1158
 
791
- # Deprecated method that is equivalent to #untaint.
1159
+ # <!--
1160
+ # rdoc-file=object.c
1161
+ # - obj.trust -> obj
1162
+ # -->
1163
+ # Returns object. This method is deprecated and will be removed in Ruby 3.2.
792
1164
  #
793
1165
  alias trust untaint
794
1166