rbs 4.0.0.dev.5 → 4.0.1.dev.1

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 (194) hide show
  1. checksums.yaml +4 -4
  2. data/.clang-format +1 -0
  3. data/.github/workflows/c-check.yml +8 -4
  4. data/.github/workflows/comments.yml +3 -1
  5. data/.github/workflows/dependabot.yml +1 -1
  6. data/.github/workflows/ruby.yml +10 -0
  7. data/.github/workflows/rust.yml +95 -0
  8. data/CHANGELOG.md +323 -0
  9. data/Rakefile +12 -29
  10. data/Steepfile +1 -0
  11. data/config.yml +393 -37
  12. data/core/array.rbs +218 -188
  13. data/core/basic_object.rbs +9 -8
  14. data/core/class.rbs +6 -5
  15. data/core/comparable.rbs +45 -31
  16. data/core/complex.rbs +52 -40
  17. data/core/dir.rbs +57 -45
  18. data/core/encoding.rbs +5 -5
  19. data/core/enumerable.rbs +96 -91
  20. data/core/enumerator.rbs +4 -3
  21. data/core/errno.rbs +3 -2
  22. data/core/errors.rbs +31 -29
  23. data/core/exception.rbs +12 -12
  24. data/core/fiber.rbs +36 -36
  25. data/core/file.rbs +186 -113
  26. data/core/file_test.rbs +2 -2
  27. data/core/float.rbs +41 -32
  28. data/core/gc.rbs +78 -70
  29. data/core/hash.rbs +70 -60
  30. data/core/integer.rbs +32 -28
  31. data/core/io/buffer.rbs +36 -36
  32. data/core/io/wait.rbs +7 -7
  33. data/core/io.rbs +120 -135
  34. data/core/kernel.rbs +189 -139
  35. data/core/marshal.rbs +3 -3
  36. data/core/match_data.rbs +14 -12
  37. data/core/math.rbs +69 -67
  38. data/core/method.rbs +6 -6
  39. data/core/module.rbs +146 -85
  40. data/core/nil_class.rbs +4 -3
  41. data/core/numeric.rbs +35 -32
  42. data/core/object.rbs +6 -8
  43. data/core/object_space.rbs +11 -10
  44. data/core/pathname.rbs +131 -81
  45. data/core/proc.rbs +65 -33
  46. data/core/process.rbs +219 -201
  47. data/core/ractor.rbs +15 -11
  48. data/core/random.rbs +4 -3
  49. data/core/range.rbs +52 -47
  50. data/core/rational.rbs +5 -5
  51. data/core/rbs/unnamed/argf.rbs +58 -51
  52. data/core/rbs/unnamed/env_class.rbs +18 -13
  53. data/core/rbs/unnamed/main_class.rbs +123 -0
  54. data/core/rbs/unnamed/random.rbs +7 -5
  55. data/core/regexp.rbs +236 -197
  56. data/core/ruby.rbs +1 -1
  57. data/core/ruby_vm.rbs +32 -30
  58. data/core/rubygems/config_file.rbs +5 -5
  59. data/core/rubygems/errors.rbs +1 -1
  60. data/core/rubygems/requirement.rbs +5 -5
  61. data/core/rubygems/rubygems.rbs +5 -3
  62. data/core/set.rbs +17 -16
  63. data/core/signal.rbs +2 -2
  64. data/core/string.rbs +311 -292
  65. data/core/struct.rbs +26 -25
  66. data/core/symbol.rbs +25 -24
  67. data/core/thread.rbs +40 -34
  68. data/core/time.rbs +47 -42
  69. data/core/trace_point.rbs +34 -31
  70. data/core/true_class.rbs +2 -2
  71. data/core/unbound_method.rbs +10 -10
  72. data/core/warning.rbs +7 -7
  73. data/docs/collection.md +1 -1
  74. data/docs/config.md +171 -0
  75. data/docs/inline.md +110 -4
  76. data/docs/syntax.md +13 -12
  77. data/ext/rbs_extension/ast_translation.c +489 -135
  78. data/ext/rbs_extension/class_constants.c +8 -0
  79. data/ext/rbs_extension/class_constants.h +4 -0
  80. data/ext/rbs_extension/legacy_location.c +28 -51
  81. data/ext/rbs_extension/legacy_location.h +37 -0
  82. data/ext/rbs_extension/main.c +12 -20
  83. data/include/rbs/ast.h +423 -195
  84. data/include/rbs/lexer.h +2 -2
  85. data/include/rbs/location.h +25 -44
  86. data/include/rbs/parser.h +2 -2
  87. data/include/rbs/util/rbs_constant_pool.h +0 -3
  88. data/include/rbs.h +8 -0
  89. data/lib/rbs/ast/ruby/annotations.rb +157 -4
  90. data/lib/rbs/ast/ruby/members.rb +374 -22
  91. data/lib/rbs/cli/validate.rb +5 -60
  92. data/lib/rbs/collection/config/lockfile_generator.rb +6 -2
  93. data/lib/rbs/definition_builder.rb +60 -27
  94. data/lib/rbs/errors.rb +0 -11
  95. data/lib/rbs/inline_parser.rb +1 -1
  96. data/lib/rbs/parser_aux.rb +20 -7
  97. data/lib/rbs/prototype/helpers.rb +57 -0
  98. data/lib/rbs/prototype/rb.rb +1 -26
  99. data/lib/rbs/prototype/rbi.rb +1 -20
  100. data/lib/rbs/test/type_check.rb +3 -0
  101. data/lib/rbs/types.rb +62 -52
  102. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  103. data/lib/rbs/version.rb +1 -1
  104. data/lib/rbs.rb +0 -1
  105. data/rbs.gemspec +1 -1
  106. data/rust/.gitignore +1 -0
  107. data/rust/Cargo.lock +378 -0
  108. data/rust/Cargo.toml +7 -0
  109. data/rust/ruby-rbs/Cargo.toml +22 -0
  110. data/rust/ruby-rbs/build.rs +764 -0
  111. data/rust/ruby-rbs/examples/locations.rs +60 -0
  112. data/rust/ruby-rbs/src/lib.rs +1 -0
  113. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  114. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  115. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  116. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  117. data/rust/ruby-rbs-sys/build.rs +204 -0
  118. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  119. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  120. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  121. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  122. data/sig/ast/ruby/annotations.rbs +191 -4
  123. data/sig/ast/ruby/members.rbs +21 -1
  124. data/sig/cli/validate.rbs +1 -6
  125. data/sig/definition_builder.rbs +2 -0
  126. data/sig/errors.rbs +0 -8
  127. data/sig/method_types.rbs +1 -1
  128. data/sig/parser.rbs +17 -13
  129. data/sig/prototype/helpers.rbs +2 -0
  130. data/sig/types.rbs +10 -11
  131. data/sig/unit_test/spy.rbs +0 -8
  132. data/sig/unit_test/type_assertions.rbs +11 -0
  133. data/src/ast.c +339 -161
  134. data/src/lexstate.c +1 -1
  135. data/src/location.c +7 -47
  136. data/src/parser.c +674 -480
  137. data/src/util/rbs_constant_pool.c +0 -4
  138. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  139. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  140. data/stdlib/coverage/0/coverage.rbs +4 -3
  141. data/stdlib/date/0/date.rbs +33 -28
  142. data/stdlib/date/0/date_time.rbs +24 -23
  143. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  144. data/stdlib/erb/0/erb.rbs +64 -53
  145. data/stdlib/etc/0/etc.rbs +55 -50
  146. data/stdlib/fileutils/0/fileutils.rbs +138 -125
  147. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  148. data/stdlib/io-console/0/io-console.rbs +2 -2
  149. data/stdlib/json/0/json.rbs +135 -108
  150. data/stdlib/monitor/0/monitor.rbs +3 -3
  151. data/stdlib/net-http/0/net-http.rbs +159 -134
  152. data/stdlib/objspace/0/objspace.rbs +8 -7
  153. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  154. data/stdlib/open3/0/open3.rbs +36 -35
  155. data/stdlib/openssl/0/openssl.rbs +144 -129
  156. data/stdlib/optparse/0/optparse.rbs +18 -14
  157. data/stdlib/pathname/0/pathname.rbs +2 -2
  158. data/stdlib/pp/0/pp.rbs +9 -8
  159. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  160. data/stdlib/pstore/0/pstore.rbs +35 -30
  161. data/stdlib/psych/0/psych.rbs +61 -8
  162. data/stdlib/psych/0/store.rbs +2 -4
  163. data/stdlib/pty/0/pty.rbs +9 -6
  164. data/stdlib/random-formatter/0/random-formatter.rbs +2 -2
  165. data/stdlib/ripper/0/ripper.rbs +20 -17
  166. data/stdlib/securerandom/0/securerandom.rbs +1 -1
  167. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  168. data/stdlib/socket/0/addrinfo.rbs +7 -7
  169. data/stdlib/socket/0/basic_socket.rbs +3 -3
  170. data/stdlib/socket/0/ip_socket.rbs +10 -8
  171. data/stdlib/socket/0/socket.rbs +10 -9
  172. data/stdlib/socket/0/tcp_server.rbs +1 -1
  173. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  174. data/stdlib/socket/0/udp_socket.rbs +1 -1
  175. data/stdlib/socket/0/unix_server.rbs +1 -1
  176. data/stdlib/stringio/0/stringio.rbs +55 -54
  177. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  178. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  179. data/stdlib/time/0/time.rbs +7 -5
  180. data/stdlib/tsort/0/tsort.rbs +7 -6
  181. data/stdlib/uri/0/common.rbs +26 -18
  182. data/stdlib/uri/0/file.rbs +2 -2
  183. data/stdlib/uri/0/generic.rbs +2 -2
  184. data/stdlib/uri/0/http.rbs +2 -2
  185. data/stdlib/uri/0/ldap.rbs +2 -2
  186. data/stdlib/uri/0/mailto.rbs +3 -3
  187. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  188. data/stdlib/zlib/0/deflate.rbs +4 -3
  189. data/stdlib/zlib/0/gzip_reader.rbs +4 -4
  190. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  191. data/stdlib/zlib/0/inflate.rbs +1 -1
  192. data/stdlib/zlib/0/need_dict.rbs +1 -1
  193. metadata +23 -5
  194. data/.github/workflows/valgrind.yml +0 -42
data/core/struct.rbs CHANGED
@@ -2,9 +2,9 @@
2
2
  # Class Struct provides a convenient way to create a simple class that can store
3
3
  # and fetch values.
4
4
  #
5
- # This example creates a subclass of `Struct`, `Struct::Customer`; the first
6
- # argument, a string, is the name of the subclass; the other arguments, symbols,
7
- # determine the *members* of the new subclass.
5
+ # This example creates a subclass of `Struct`, <code>Struct::Customer</code>;
6
+ # the first argument, a string, is the name of the subclass; the other
7
+ # arguments, symbols, determine the *members* of the new subclass.
8
8
  #
9
9
  # Customer = Struct.new('Customer', :name, :address, :zip)
10
10
  # Customer.name # => "Struct::Customer"
@@ -18,7 +18,7 @@
18
18
  # methods # => [:zip, :address=, :zip=, :address, :name, :name=]
19
19
  #
20
20
  # An instance of the subclass may be created, and its members assigned values,
21
- # via method `::new`:
21
+ # via method <code>::new</code>:
22
22
  #
23
23
  # joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
24
24
  # joe # => #<struct Struct::Customer name="Joe Smith", address="123 Maple, Anytown NC", zip=12345>
@@ -71,10 +71,10 @@
71
71
  #
72
72
  # ### Methods for Comparing
73
73
  #
74
- # * #==: Returns whether a given object is equal to `self`, using `==` to
75
- # compare member values.
76
- # * #eql?: Returns whether a given object is equal to `self`, using `eql?` to
77
- # compare member values.
74
+ # * #==: Returns whether a given object is equal to `self`, using
75
+ # <code>==</code> to compare member values.
76
+ # * #eql?: Returns whether a given object is equal to `self`, using
77
+ # <code>eql?</code> to compare member values.
78
78
  #
79
79
  # ### Methods for Fetching
80
80
  #
@@ -119,13 +119,13 @@ class Struct[Elem]
119
119
  # - Struct_subclass.new(*member_names) -> Struct_subclass_instance
120
120
  # - Struct_subclass.new(**member_names) -> Struct_subclass_instance
121
121
  # -->
122
- # `Struct.new` returns a new subclass of `Struct`. The new subclass:
122
+ # <code>Struct.new</code> returns a new subclass of `Struct`. The new subclass:
123
123
  #
124
124
  # * May be anonymous, or may have the name given by `class_name`.
125
125
  # * May have members as given by `member_names`.
126
126
  # * May have initialization via ordinary arguments, or via keyword arguments
127
127
  #
128
- # The new subclass has its own method `::new`; thus:
128
+ # The new subclass has its own method <code>::new</code>; thus:
129
129
  #
130
130
  # Foo = Struct.new('Foo', :foo, :bar) # => Struct::Foo
131
131
  # f = Foo.new(0, 1) # => #<struct Struct::Foo foo=0, bar=1>
@@ -133,7 +133,7 @@ class Struct[Elem]
133
133
  # **Class Name**
134
134
  #
135
135
  # With string argument `class_name`, returns a new subclass of `Struct` named
136
- # `Struct::*class_name`*:
136
+ # <code>Struct::<em>class_name</em></code>:
137
137
  #
138
138
  # Foo = Struct.new('Foo', :foo, :bar) # => Struct::Foo
139
139
  # Foo.name # => "Struct::Foo"
@@ -158,7 +158,7 @@ class Struct[Elem]
158
158
  # dave # => #<struct Struct::Customer name="Dave", address="123 Main">
159
159
  # dave.greeting # => "Hello Dave at 123 Main"
160
160
  #
161
- # Output, from `Struct.new`:
161
+ # Output, from <code>Struct.new</code>:
162
162
  #
163
163
  # "The new subclass is Struct::Customer"
164
164
  #
@@ -184,7 +184,7 @@ class Struct[Elem]
184
184
  #
185
185
  # A subclass returned by Struct.new has these singleton methods:
186
186
  #
187
- # * Method `::new ` creates an instance of the subclass:
187
+ # * Method <code>::new </code> creates an instance of the subclass:
188
188
  #
189
189
  # Foo.new # => #<struct Struct::Foo foo=nil, bar=nil>
190
190
  # Foo.new(0) # => #<struct Struct::Foo foo=0, bar=nil>
@@ -197,12 +197,13 @@ class Struct[Elem]
197
197
  # Foo.new(foo: 0, bar: 1, baz: 2)
198
198
  # # Raises ArgumentError: unknown keywords: baz
199
199
  #
200
- # * Method `:inspect` returns a string representation of the subclass:
200
+ # * Method <code>:inspect</code> returns a string representation of the
201
+ # subclass:
201
202
  #
202
203
  # Foo.inspect
203
204
  # # => "Struct::Foo"
204
205
  #
205
- # * Method `::members` returns an array of the member names:
206
+ # * Method <code>::members</code> returns an array of the member names:
206
207
  #
207
208
  # Foo.members # => [:foo, :bar]
208
209
  #
@@ -211,8 +212,8 @@ class Struct[Elem]
211
212
  # By default, the arguments for initializing an instance of the new subclass can
212
213
  # be both positional and keyword arguments.
213
214
  #
214
- # Optional keyword argument `keyword_init:` allows to force only one type of
215
- # arguments to be accepted:
215
+ # Optional keyword argument <code>keyword_init:</code> allows to force only one
216
+ # type of arguments to be accepted:
216
217
  #
217
218
  # KeywordsOnly = Struct.new(:foo, :bar, keyword_init: true)
218
219
  # KeywordsOnly.new(bar: 1, foo: 0)
@@ -252,8 +253,8 @@ class Struct[Elem]
252
253
  # rdoc-file=struct.c
253
254
  # - StructClass::keyword_init? -> true or falsy value
254
255
  # -->
255
- # Returns `true` if the class was initialized with `keyword_init: true`.
256
- # Otherwise returns `nil` or `false`.
256
+ # Returns `true` if the class was initialized with <code>keyword_init:
257
+ # true</code>. Otherwise returns `nil` or `false`.
257
258
  #
258
259
  # Examples:
259
260
  # Foo = Struct.new(:a)
@@ -272,8 +273,8 @@ class Struct[Elem]
272
273
  # Returns `true` if and only if the following are true; otherwise returns
273
274
  # `false`:
274
275
  #
275
- # * `other.class == self.class`.
276
- # * For each member name `name`, `other.name == self.name`.
276
+ # * <code>other.class == self.class</code>.
277
+ # * For each member name `name`, <code>other.name == self.name</code>.
277
278
  #
278
279
  # Examples:
279
280
  #
@@ -294,8 +295,8 @@ class Struct[Elem]
294
295
  # Returns `true` if and only if the following are true; otherwise returns
295
296
  # `false`:
296
297
  #
297
- # * `other.class == self.class`.
298
- # * For each member name `name`, `other.name.eql?(self.name)`.
298
+ # * <code>other.class == self.class</code>.
299
+ # * For each member name `name`, <code>other.name.eql?(self.name)</code>.
299
300
  #
300
301
  # Customer = Struct.new(:name, :address, :zip)
301
302
  # joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
@@ -483,8 +484,8 @@ class Struct[Elem]
483
484
  #
484
485
  # Raises NameError if `name` is not the name of a member.
485
486
  #
486
- # With integer argument `n` given, returns `self.values[n]` if `n` is in range;
487
- # see Array@Array+Indexes:
487
+ # With integer argument `n` given, returns <code>self.values[n]</code> if `n` is
488
+ # in range; see Array@Array+Indexes:
488
489
  #
489
490
  # joe[2] # => 12345
490
491
  # joe[-2] # => "123 Maple, Anytown NC"
data/core/symbol.rbs CHANGED
@@ -8,8 +8,8 @@
8
8
  # The same `Symbol` object will be created for a given name or string for the
9
9
  # duration of a program's execution, regardless of the context or meaning of
10
10
  # that name. Thus if `Fred` is a constant in one context, a method in another,
11
- # and a class in a third, the `Symbol` `:Fred` will be the same object in all
12
- # three contexts.
11
+ # and a class in a third, the `Symbol` <code>:Fred</code> will be the same
12
+ # object in all three contexts.
13
13
  #
14
14
  # module One
15
15
  # class Fred
@@ -75,7 +75,8 @@
75
75
  # given Regexp or other object; returns `nil` if no match is found.
76
76
  # * #[], #slice : Returns a substring of symbol determined by a given index,
77
77
  # start/length, or range, or string.
78
- # * #empty?: Returns `true` if `self.length` is zero; `false` otherwise.
78
+ # * #empty?: Returns `true` if <code>self.length</code> is zero; `false`
79
+ # otherwise.
79
80
  # * #encoding: Returns the Encoding object that represents the encoding of
80
81
  # symbol.
81
82
  # * #end_with?: Returns `true` if symbol ends with any of the given strings.
@@ -136,7 +137,7 @@ class Symbol
136
137
  #
137
138
  # Returns:
138
139
  #
139
- # * `self.to_s <=> other.to_s`, if `other` is a symbol.
140
+ # * <code>self.to_s <=> other.to_s</code>, if `other` is a symbol.
140
141
  # * `nil`, otherwise.
141
142
  #
142
143
  # Examples:
@@ -171,8 +172,8 @@ class Symbol
171
172
  # rdoc-file=string.c
172
173
  # - symbol =~ object -> integer or nil
173
174
  # -->
174
- # Equivalent to `symbol.to_s =~ object`, including possible updates to global
175
- # variables; see String#=~.
175
+ # Equivalent to <code>symbol.to_s =~ object</code>, including possible updates
176
+ # to global variables; see String#=~.
176
177
  #
177
178
  def =~: (Regexp regex) -> Integer?
178
179
  | [T] (String::_MatchAgainst[String, T] object) -> T
@@ -185,7 +186,7 @@ class Symbol
185
186
  # - symbol[regexp, capture = 0] -> string or nil
186
187
  # - symbol[substring] -> string or nil
187
188
  # -->
188
- # Equivalent to `symbol.to_s[]`; see String#[].
189
+ # Equivalent to <code>symbol.to_s[]</code>; see String#[].
189
190
  #
190
191
  def []: (int start, ?int length) -> String?
191
192
  | (range[int?] range) -> String?
@@ -196,7 +197,7 @@ class Symbol
196
197
  # rdoc-file=string.c
197
198
  # - capitalize(mapping) -> symbol
198
199
  # -->
199
- # Equivalent to `sym.to_s.capitalize.to_sym`.
200
+ # Equivalent to <code>sym.to_s.capitalize.to_sym</code>.
200
201
  #
201
202
  # See String#capitalize.
202
203
  #
@@ -210,7 +211,7 @@ class Symbol
210
211
  # - casecmp(object) -> -1, 0, 1, or nil
211
212
  # -->
212
213
  # Like Symbol#<=>, but case-insensitive; equivalent to
213
- # `self.to_s.casecmp(object.to_s)`:
214
+ # <code>self.to_s.casecmp(object.to_s)</code>:
214
215
  #
215
216
  # lower = :abc
216
217
  # upper = :ABC
@@ -276,7 +277,7 @@ class Symbol
276
277
  # rdoc-file=string.c
277
278
  # - downcase(mapping) -> symbol
278
279
  # -->
279
- # Equivalent to `sym.to_s.downcase.to_sym`.
280
+ # Equivalent to <code>sym.to_s.downcase.to_sym</code>.
280
281
  #
281
282
  # See String#downcase.
282
283
  #
@@ -291,7 +292,7 @@ class Symbol
291
292
  # rdoc-file=string.c
292
293
  # - empty? -> true or false
293
294
  # -->
294
- # Returns `true` if `self` is `:''`, `false` otherwise.
295
+ # Returns `true` if `self` is <code>:''</code>, `false` otherwise.
295
296
  #
296
297
  def empty?: () -> bool
297
298
 
@@ -299,7 +300,7 @@ class Symbol
299
300
  # rdoc-file=string.c
300
301
  # - encoding -> encoding
301
302
  # -->
302
- # Equivalent to `self.to_s.encoding`; see String#encoding.
303
+ # Equivalent to <code>self.to_s.encoding</code>; see String#encoding.
303
304
  #
304
305
  def encoding: () -> Encoding
305
306
 
@@ -307,7 +308,7 @@ class Symbol
307
308
  # rdoc-file=string.c
308
309
  # - end_with?(*strings) -> true or false
309
310
  # -->
310
- # Equivalent to `self.to_s.end_with?`; see String#end_with?.
311
+ # Equivalent to <code>self.to_s.end_with?</code>; see String#end_with?.
311
312
  #
312
313
  def end_with?: (*string suffixes) -> bool
313
314
 
@@ -341,7 +342,7 @@ class Symbol
341
342
  # rdoc-file=string.c
342
343
  # - length -> integer
343
344
  # -->
344
- # Equivalent to `self.to_s.length`; see String#length.
345
+ # Equivalent to <code>self.to_s.length</code>; see String#length.
345
346
  #
346
347
  def length: () -> Integer
347
348
 
@@ -350,8 +351,8 @@ class Symbol
350
351
  # - match(pattern, offset = 0) -> matchdata or nil
351
352
  # - match(pattern, offset = 0) {|matchdata| } -> object
352
353
  # -->
353
- # Equivalent to `self.to_s.match`, including possible updates to global
354
- # variables; see String#match.
354
+ # Equivalent to <code>self.to_s.match</code>, including possible updates to
355
+ # global variables; see String#match.
355
356
  #
356
357
  def match: (Regexp | string pattern, ?int offset) -> MatchData?
357
358
  | [T] (Regexp | string pattern, ?int offset) { (MatchData matchdata) -> T } -> T?
@@ -360,12 +361,12 @@ class Symbol
360
361
  # rdoc-file=string.c
361
362
  # - match?(pattern, offset) -> true or false
362
363
  # -->
363
- # Equivalent to `sym.to_s.match?`; see String#match.
364
+ # Equivalent to <code>sym.to_s.match?</code>; see String#match.
364
365
  #
365
366
  def match?: (Regexp | string pattern, ?int offset) -> bool
366
367
 
367
368
  # <!-- rdoc-file=string.c -->
368
- # Equivalent to `self.to_s.succ.to_sym`:
369
+ # Equivalent to <code>self.to_s.succ.to_sym</code>:
369
370
  #
370
371
  # :foo.succ # => :fop
371
372
  #
@@ -388,12 +389,12 @@ class Symbol
388
389
  def name: () -> String
389
390
 
390
391
  # <!-- rdoc-file=string.c -->
391
- # Equivalent to `self.to_s.length`; see String#length.
392
+ # Equivalent to <code>self.to_s.length</code>; see String#length.
392
393
  #
393
394
  alias size length
394
395
 
395
396
  # <!-- rdoc-file=string.c -->
396
- # Equivalent to `symbol.to_s[]`; see String#[].
397
+ # Equivalent to <code>symbol.to_s[]</code>; see String#[].
397
398
  #
398
399
  alias slice []
399
400
 
@@ -401,7 +402,7 @@ class Symbol
401
402
  # rdoc-file=string.c
402
403
  # - start_with?(*string_or_regexp) -> true or false
403
404
  # -->
404
- # Equivalent to `self.to_s.start_with?`; see String#start_with?.
405
+ # Equivalent to <code>self.to_s.start_with?</code>; see String#start_with?.
405
406
  #
406
407
  def start_with?: (*Regexp | string prefixes) -> bool
407
408
 
@@ -409,7 +410,7 @@ class Symbol
409
410
  # rdoc-file=string.c
410
411
  # - succ
411
412
  # -->
412
- # Equivalent to `self.to_s.succ.to_sym`:
413
+ # Equivalent to <code>self.to_s.succ.to_sym</code>:
413
414
  #
414
415
  # :foo.succ # => :fop
415
416
  #
@@ -421,7 +422,7 @@ class Symbol
421
422
  # rdoc-file=string.c
422
423
  # - swapcase(mapping) -> symbol
423
424
  # -->
424
- # Equivalent to `sym.to_s.swapcase.to_sym`.
425
+ # Equivalent to <code>sym.to_s.swapcase.to_sym</code>.
425
426
  #
426
427
  # See String#swapcase.
427
428
  #
@@ -470,7 +471,7 @@ class Symbol
470
471
  # rdoc-file=string.c
471
472
  # - upcase(mapping) -> symbol
472
473
  # -->
473
- # Equivalent to `sym.to_s.upcase.to_sym`.
474
+ # Equivalent to <code>sym.to_s.upcase.to_sym</code>.
474
475
  #
475
476
  # See String#upcase.
476
477
  #
data/core/thread.rbs CHANGED
@@ -14,8 +14,8 @@
14
14
  #
15
15
  # thr.join #=> "What's the big deal"
16
16
  #
17
- # If we don't call `thr.join` before the main thread terminates, then all other
18
- # threads including `thr` will be killed.
17
+ # If we don't call <code>thr.join</code> before the main thread terminates, then
18
+ # all other threads including `thr` will be killed.
19
19
  #
20
20
  # Alternatively, you can use an array for handling multiple threads at once,
21
21
  # like in the following example:
@@ -105,8 +105,8 @@
105
105
  # p Thread.current.thread_variable_get(:foo) # => 2
106
106
  # }.join
107
107
  #
108
- # You can see that the thread-local `:foo` carried over into the fiber and was
109
- # changed to `2` by the end of the thread.
108
+ # You can see that the thread-local <code>:foo</code> carried over into the
109
+ # fiber and was changed to `2` by the end of the thread.
110
110
  #
111
111
  # This example makes use of #thread_variable_set to create new thread-locals,
112
112
  # and #thread_variable_get to reference them.
@@ -617,13 +617,13 @@ class Thread < Object
617
617
  # -->
618
618
  # Returns the status of `thr`.
619
619
  #
620
- # `"sleep"`
620
+ # <code>"sleep"</code>
621
621
  # : Returned if this thread is sleeping or waiting on I/O
622
622
  #
623
- # `"run"`
623
+ # <code>"run"</code>
624
624
  # : When this thread is executing
625
625
  #
626
- # `"aborting"`
626
+ # <code>"aborting"</code>
627
627
  # : If this thread is aborting
628
628
  #
629
629
  # `false`
@@ -769,7 +769,8 @@ class Thread < Object
769
769
  # Marks a given thread as eligible for scheduling, however it may still remain
770
770
  # blocked on I/O.
771
771
  #
772
- # **Note:** This does not invoke the scheduler, see #run for more information.
772
+ # <strong>Note:</strong> This does not invoke the scheduler, see #run for more
773
+ # information.
773
774
  #
774
775
  # c = Thread.new { Thread.stop; puts "hey!" }
775
776
  # sleep 0.1 while c.status!='sleep'
@@ -790,7 +791,8 @@ class Thread < Object
790
791
  # When set to `true`, if any thread is aborted by an exception, the raised
791
792
  # exception will be re-raised in the main thread.
792
793
  #
793
- # Can also be specified by the global $DEBUG flag or command line option `-d`.
794
+ # Can also be specified by the global $DEBUG flag or command line option
795
+ # <code>-d</code>.
794
796
  #
795
797
  # See also ::abort_on_exception=.
796
798
  #
@@ -872,17 +874,17 @@ class Thread < Object
872
874
  # Thread#raise, Thread#kill, signal trap (not supported yet) and main thread
873
875
  # termination (if main thread terminates, then all other thread will be killed).
874
876
  #
875
- # The given `hash` has pairs like `ExceptionClass => :TimingSymbol`. Where the
876
- # ExceptionClass is the interrupt handled by the given block. The TimingSymbol
877
- # can be one of the following symbols:
877
+ # The given `hash` has pairs like <code>ExceptionClass => :TimingSymbol</code>.
878
+ # Where the ExceptionClass is the interrupt handled by the given block. The
879
+ # TimingSymbol can be one of the following symbols:
878
880
  #
879
- # `:immediate`
881
+ # <code>:immediate</code>
880
882
  # : Invoke interrupts immediately.
881
883
  #
882
- # `:on_blocking`
884
+ # <code>:on_blocking</code>
883
885
  # : Invoke interrupts while *BlockingOperation*.
884
886
  #
885
- # `:never`
887
+ # <code>:never</code>
886
888
  # : Never invoke all interrupts.
887
889
  #
888
890
  #
@@ -906,8 +908,8 @@ class Thread < Object
906
908
  #
907
909
  # In this example, we can guard from Thread#raise exceptions.
908
910
  #
909
- # Using the `:never` TimingSymbol the RuntimeError exception will always be
910
- # ignored in the first block of the main thread. In the second
911
+ # Using the <code>:never</code> TimingSymbol the RuntimeError exception will
912
+ # always be ignored in the first block of the main thread. In the second
911
913
  # ::handle_interrupt block we can purposefully handle RuntimeError exceptions.
912
914
  #
913
915
  # th = Thread.new do
@@ -1030,7 +1032,8 @@ class Thread < Object
1030
1032
  # Since Thread::handle_interrupt can be used to defer asynchronous events, this
1031
1033
  # method can be used to determine if there are any deferred events.
1032
1034
  #
1033
- # If you find this method returns true, then you may finish `:never` blocks.
1035
+ # If you find this method returns true, then you may finish <code>:never</code>
1036
+ # blocks.
1034
1037
  #
1035
1038
  # For example, the following method processes deferred asynchronous events
1036
1039
  # immediately.
@@ -1108,9 +1111,9 @@ class Thread < Object
1108
1111
  # where it is raised rather then let it kill the Thread.
1109
1112
  # * If it is guaranteed the Thread will be joined with Thread#join or
1110
1113
  # Thread#value, then it is safe to disable this report with
1111
- # `Thread.current.report_on_exception = false` when starting the Thread.
1112
- # However, this might handle the exception much later, or not at all if the
1113
- # Thread is never joined due to the parent thread being blocked, etc.
1114
+ # <code>Thread.current.report_on_exception = false</code> when starting the
1115
+ # Thread. However, this might handle the exception much later, or not at all
1116
+ # if the Thread is never joined due to the parent thread being blocked, etc.
1114
1117
  #
1115
1118
  # See also ::report_on_exception=.
1116
1119
  #
@@ -1188,10 +1191,11 @@ class Thread::Backtrace < Object
1188
1191
  # rdoc-file=vm_backtrace.c
1189
1192
  # - Thread::Backtrace::limit -> integer
1190
1193
  # -->
1191
- # Returns maximum backtrace length set by `--backtrace-limit` command-line
1192
- # option. The default is `-1` which means unlimited backtraces. If the value is
1193
- # zero or positive, the error backtraces, produced by Exception#full_message,
1194
- # are abbreviated and the extra lines are replaced by `... 3 levels... `
1194
+ # Returns maximum backtrace length set by <code>--backtrace-limit</code>
1195
+ # command-line option. The default is <code>-1</code> which means unlimited
1196
+ # backtraces. If the value is zero or positive, the error backtraces, produced
1197
+ # by Exception#full_message, are abbreviated and the extra lines are replaced by
1198
+ # <code>... 3 levels... </code>
1195
1199
  #
1196
1200
  # $ ruby -r net/http -e "p Thread::Backtrace.limit; Net::HTTP.get(URI('http://wrong.address'))"
1197
1201
  # - 1
@@ -1257,7 +1261,7 @@ end
1257
1261
  # puts call.to_s
1258
1262
  # end
1259
1263
  #
1260
- # Running `ruby caller_locations.rb` will produce:
1264
+ # Running <code>ruby caller_locations.rb</code> will produce:
1261
1265
  #
1262
1266
  # caller_locations.rb:2:in `a'
1263
1267
  # caller_locations.rb:5:in `b'
@@ -1277,7 +1281,7 @@ end
1277
1281
  # puts call.to_s
1278
1282
  # end
1279
1283
  #
1280
- # Now run `ruby foo.rb` and you should see:
1284
+ # Now run <code>ruby foo.rb</code> and you should see:
1281
1285
  #
1282
1286
  # init.rb:4:in `initialize'
1283
1287
  # init.rb:8:in `new'
@@ -1360,7 +1364,8 @@ class Thread::Backtrace::Location
1360
1364
  # -->
1361
1365
  # Returns the line number of this frame.
1362
1366
  #
1363
- # For example, using `caller_locations.rb` from Thread::Backtrace::Location
1367
+ # For example, using <code>caller_locations.rb</code> from
1368
+ # Thread::Backtrace::Location
1364
1369
  #
1365
1370
  # loc = c(0..1).first
1366
1371
  # loc.lineno #=> 2
@@ -1375,7 +1380,8 @@ class Thread::Backtrace::Location
1375
1380
  # unless the frame is in the main script, in which case it will be the script
1376
1381
  # location passed on the command line.
1377
1382
  #
1378
- # For example, using `caller_locations.rb` from Thread::Backtrace::Location
1383
+ # For example, using <code>caller_locations.rb</code> from
1384
+ # Thread::Backtrace::Location
1379
1385
  #
1380
1386
  # loc = c(0..1).first
1381
1387
  # loc.path #=> caller_locations.rb
@@ -1620,16 +1626,16 @@ class Thread::Queue[Elem = untyped] < Object
1620
1626
  #
1621
1627
  # After the call to close completes, the following are true:
1622
1628
  #
1623
- # * `closed?` will return true
1629
+ # * <code>closed?</code> will return true
1624
1630
  #
1625
1631
  # * `close` will be ignored.
1626
1632
  #
1627
1633
  # * calling enq/push/<< will raise a `ClosedQueueError`.
1628
1634
  #
1629
- # * when `empty?` is false, calling deq/pop/shift will return an object from
1630
- # the queue as usual.
1631
- # * when `empty?` is true, deq(false) will not suspend the thread and will
1632
- # return nil. deq(true) will raise a `ThreadError`.
1635
+ # * when <code>empty?</code> is false, calling deq/pop/shift will return an
1636
+ # object from the queue as usual.
1637
+ # * when <code>empty?</code> is true, deq(false) will not suspend the thread
1638
+ # and will return nil. deq(true) will raise a `ThreadError`.
1633
1639
  #
1634
1640
  # ClosedQueueError is inherited from StopIteration, so that you can break loop
1635
1641
  # block.