rbs 3.10.4 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +14 -14
  3. data/.github/workflows/bundle-update.yml +60 -0
  4. data/.github/workflows/c-check.yml +7 -5
  5. data/.github/workflows/comments.yml +2 -2
  6. data/.github/workflows/dependabot.yml +2 -2
  7. data/.github/workflows/ruby.yml +16 -26
  8. data/.github/workflows/rust.yml +95 -0
  9. data/.github/workflows/typecheck.yml +1 -1
  10. data/.github/workflows/windows.yml +2 -2
  11. data/.rubocop.yml +2 -2
  12. data/.vscode/extensions.json +5 -0
  13. data/.vscode/settings.json +19 -0
  14. data/CHANGELOG.md +202 -2
  15. data/Rakefile +9 -23
  16. data/Steepfile +2 -0
  17. data/config.yml +457 -13
  18. data/core/array.rbs +218 -188
  19. data/core/basic_object.rbs +9 -8
  20. data/core/binding.rbs +0 -2
  21. data/core/builtin.rbs +2 -2
  22. data/core/class.rbs +6 -5
  23. data/core/comparable.rbs +45 -31
  24. data/core/complex.rbs +66 -55
  25. data/core/dir.rbs +57 -45
  26. data/core/encoding.rbs +6 -6
  27. data/core/enumerable.rbs +105 -91
  28. data/core/enumerator/arithmetic_sequence.rbs +70 -0
  29. data/core/enumerator.rbs +24 -3
  30. data/core/errno.rbs +3 -2
  31. data/core/errors.rbs +31 -29
  32. data/core/exception.rbs +12 -12
  33. data/core/fiber.rbs +47 -36
  34. data/core/file.rbs +242 -169
  35. data/core/file_test.rbs +2 -2
  36. data/core/float.rbs +42 -68
  37. data/core/gc.rbs +78 -70
  38. data/core/hash.rbs +70 -60
  39. data/core/integer.rbs +32 -75
  40. data/core/io/buffer.rbs +36 -36
  41. data/core/io/wait.rbs +7 -7
  42. data/core/io.rbs +192 -146
  43. data/core/kernel.rbs +198 -147
  44. data/core/marshal.rbs +3 -3
  45. data/core/match_data.rbs +14 -12
  46. data/core/math.rbs +69 -67
  47. data/core/method.rbs +6 -8
  48. data/core/module.rbs +148 -88
  49. data/core/nil_class.rbs +4 -3
  50. data/core/numeric.rbs +53 -50
  51. data/core/object.rbs +6 -8
  52. data/core/object_space.rbs +11 -10
  53. data/core/pathname.rbs +131 -81
  54. data/core/proc.rbs +65 -34
  55. data/core/process.rbs +221 -201
  56. data/core/ractor.rbs +15 -11
  57. data/core/random.rbs +21 -3
  58. data/core/range.rbs +152 -49
  59. data/core/rational.rbs +5 -56
  60. data/core/rbs/unnamed/argf.rbs +58 -51
  61. data/core/rbs/unnamed/env_class.rbs +18 -13
  62. data/core/rbs/unnamed/main_class.rbs +123 -0
  63. data/core/rbs/unnamed/random.rbs +7 -116
  64. data/core/regexp.rbs +236 -197
  65. data/core/ruby.rbs +1 -1
  66. data/core/ruby_vm.rbs +32 -30
  67. data/core/rubygems/config_file.rbs +5 -5
  68. data/core/rubygems/errors.rbs +1 -1
  69. data/core/rubygems/requirement.rbs +5 -5
  70. data/core/rubygems/rubygems.rbs +5 -3
  71. data/core/set.rbs +17 -16
  72. data/core/signal.rbs +2 -2
  73. data/core/string.rbs +318 -298
  74. data/core/struct.rbs +26 -25
  75. data/core/symbol.rbs +25 -24
  76. data/core/thread.rbs +40 -41
  77. data/core/time.rbs +47 -42
  78. data/core/trace_point.rbs +34 -31
  79. data/core/true_class.rbs +2 -2
  80. data/core/unbound_method.rbs +10 -10
  81. data/core/warning.rbs +7 -7
  82. data/docs/collection.md +1 -1
  83. data/docs/config.md +171 -0
  84. data/docs/inline.md +576 -0
  85. data/docs/syntax.md +46 -16
  86. data/docs/type_fingerprint.md +21 -0
  87. data/exe/rbs +1 -1
  88. data/ext/rbs_extension/ast_translation.c +595 -98
  89. data/ext/rbs_extension/class_constants.c +30 -0
  90. data/ext/rbs_extension/class_constants.h +15 -0
  91. data/ext/rbs_extension/legacy_location.c +30 -53
  92. data/ext/rbs_extension/legacy_location.h +37 -0
  93. data/ext/rbs_extension/main.c +125 -24
  94. data/include/rbs/ast.h +485 -150
  95. data/include/rbs/lexer.h +11 -4
  96. data/include/rbs/location.h +25 -44
  97. data/include/rbs/parser.h +20 -2
  98. data/include/rbs/util/rbs_constant_pool.h +0 -3
  99. data/include/rbs.h +8 -0
  100. data/lib/rbs/ast/annotation.rb +1 -1
  101. data/lib/rbs/ast/comment.rb +1 -1
  102. data/lib/rbs/ast/declarations.rb +10 -10
  103. data/lib/rbs/ast/members.rb +14 -14
  104. data/lib/rbs/ast/ruby/annotations.rb +409 -0
  105. data/lib/rbs/ast/ruby/comment_block.rb +245 -0
  106. data/lib/rbs/ast/ruby/declarations.rb +281 -0
  107. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +28 -0
  108. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  109. data/lib/rbs/ast/ruby/members.rb +723 -0
  110. data/lib/rbs/ast/type_param.rb +24 -4
  111. data/lib/rbs/buffer.rb +105 -20
  112. data/lib/rbs/cli/diff.rb +16 -15
  113. data/lib/rbs/cli/validate.rb +62 -125
  114. data/lib/rbs/cli.rb +55 -23
  115. data/lib/rbs/collection/config/lockfile_generator.rb +8 -4
  116. data/lib/rbs/collection/sources/git.rb +1 -0
  117. data/lib/rbs/collection.rb +0 -1
  118. data/lib/rbs/definition.rb +6 -1
  119. data/lib/rbs/definition_builder/ancestor_builder.rb +119 -63
  120. data/lib/rbs/definition_builder/method_builder.rb +65 -30
  121. data/lib/rbs/definition_builder.rb +177 -20
  122. data/lib/rbs/diff.rb +7 -1
  123. data/lib/rbs/environment/class_entry.rb +69 -0
  124. data/lib/rbs/environment/module_entry.rb +66 -0
  125. data/lib/rbs/environment.rb +338 -155
  126. data/lib/rbs/environment_loader.rb +2 -2
  127. data/lib/rbs/errors.rb +30 -20
  128. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  129. data/lib/rbs/inline_parser.rb +542 -0
  130. data/lib/rbs/location_aux.rb +36 -4
  131. data/lib/rbs/locator.rb +5 -1
  132. data/lib/rbs/method_type.rb +5 -3
  133. data/lib/rbs/namespace.rb +0 -7
  134. data/lib/rbs/parser_aux.rb +31 -8
  135. data/lib/rbs/prototype/helpers.rb +57 -0
  136. data/lib/rbs/prototype/rb.rb +3 -28
  137. data/lib/rbs/prototype/rbi.rb +3 -20
  138. data/lib/rbs/prototype/runtime.rb +10 -2
  139. data/lib/rbs/resolver/type_name_resolver.rb +0 -8
  140. data/lib/rbs/source.rb +99 -0
  141. data/lib/rbs/subtractor.rb +4 -3
  142. data/lib/rbs/test/type_check.rb +5 -2
  143. data/lib/rbs/type_name.rb +1 -8
  144. data/lib/rbs/types.rb +88 -78
  145. data/lib/rbs/unit_test/convertibles.rb +1 -0
  146. data/lib/rbs/unit_test/type_assertions.rb +35 -8
  147. data/lib/rbs/validator.rb +2 -2
  148. data/lib/rbs/version.rb +1 -1
  149. data/lib/rbs.rb +12 -1
  150. data/rbs.gemspec +3 -2
  151. data/rust/.gitignore +1 -0
  152. data/rust/Cargo.lock +378 -0
  153. data/rust/Cargo.toml +7 -0
  154. data/rust/ruby-rbs/Cargo.toml +22 -0
  155. data/rust/ruby-rbs/build.rs +764 -0
  156. data/rust/ruby-rbs/examples/locations.rs +60 -0
  157. data/rust/ruby-rbs/src/lib.rs +1 -0
  158. data/rust/ruby-rbs/src/node/mod.rs +742 -0
  159. data/rust/ruby-rbs/tests/sanity.rs +47 -0
  160. data/rust/ruby-rbs/vendor/rbs/config.yml +1 -0
  161. data/rust/ruby-rbs-sys/Cargo.toml +23 -0
  162. data/rust/ruby-rbs-sys/build.rs +204 -0
  163. data/rust/ruby-rbs-sys/src/lib.rs +50 -0
  164. data/rust/ruby-rbs-sys/vendor/rbs/include +1 -0
  165. data/rust/ruby-rbs-sys/vendor/rbs/src +1 -0
  166. data/rust/ruby-rbs-sys/wrapper.h +1 -0
  167. data/schema/typeParam.json +17 -1
  168. data/sig/ancestor_builder.rbs +1 -1
  169. data/sig/ast/ruby/annotations.rbs +421 -0
  170. data/sig/ast/ruby/comment_block.rbs +127 -0
  171. data/sig/ast/ruby/declarations.rbs +158 -0
  172. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  173. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  174. data/sig/ast/ruby/members.rbs +178 -0
  175. data/sig/buffer.rbs +63 -5
  176. data/sig/cli/diff.rbs +5 -11
  177. data/sig/cli/validate.rbs +12 -8
  178. data/sig/cli.rbs +18 -18
  179. data/sig/definition.rbs +6 -0
  180. data/sig/definition_builder.rbs +3 -1
  181. data/sig/environment/class_entry.rbs +50 -0
  182. data/sig/environment/module_entry.rbs +50 -0
  183. data/sig/environment.rbs +37 -81
  184. data/sig/errors.rbs +26 -20
  185. data/sig/inline_parser/comment_association.rbs +71 -0
  186. data/sig/inline_parser.rbs +124 -0
  187. data/sig/location.rbs +32 -7
  188. data/sig/locator.rbs +0 -2
  189. data/sig/method_builder.rbs +9 -4
  190. data/sig/namespace.rbs +0 -5
  191. data/sig/parser.rbs +47 -13
  192. data/sig/prototype/helpers.rbs +2 -0
  193. data/sig/resolver/type_name_resolver.rbs +0 -3
  194. data/sig/source.rbs +48 -0
  195. data/sig/type_param.rbs +13 -8
  196. data/sig/typename.rbs +0 -5
  197. data/sig/types.rbs +6 -7
  198. data/sig/unit_test/spy.rbs +0 -8
  199. data/sig/unit_test/type_assertions.rbs +11 -0
  200. data/src/ast.c +491 -143
  201. data/src/lexer.c +1552 -1314
  202. data/src/lexer.re +7 -0
  203. data/src/lexstate.c +8 -1
  204. data/src/location.c +8 -48
  205. data/src/parser.c +1107 -409
  206. data/src/util/rbs_constant_pool.c +0 -4
  207. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -16
  208. data/stdlib/cgi-escape/0/escape.rbs +4 -4
  209. data/stdlib/coverage/0/coverage.rbs +4 -3
  210. data/stdlib/date/0/date.rbs +33 -28
  211. data/stdlib/date/0/date_time.rbs +24 -23
  212. data/stdlib/did_you_mean/0/did_you_mean.rbs +17 -16
  213. data/stdlib/digest/0/digest.rbs +110 -0
  214. data/stdlib/erb/0/erb.rbs +64 -53
  215. data/stdlib/etc/0/etc.rbs +55 -50
  216. data/stdlib/fileutils/0/fileutils.rbs +140 -126
  217. data/stdlib/forwardable/0/forwardable.rbs +10 -10
  218. data/stdlib/io-console/0/io-console.rbs +2 -2
  219. data/stdlib/json/0/json.rbs +158 -131
  220. data/stdlib/monitor/0/monitor.rbs +3 -3
  221. data/stdlib/net-http/0/net-http.rbs +159 -134
  222. data/stdlib/objspace/0/objspace.rbs +8 -30
  223. data/stdlib/open-uri/0/open-uri.rbs +8 -8
  224. data/stdlib/open3/0/open3.rbs +469 -10
  225. data/stdlib/openssl/0/openssl.rbs +144 -129
  226. data/stdlib/optparse/0/optparse.rbs +23 -14
  227. data/stdlib/pathname/0/pathname.rbs +2 -2
  228. data/stdlib/pp/0/pp.rbs +9 -8
  229. data/stdlib/prettyprint/0/prettyprint.rbs +7 -7
  230. data/stdlib/pstore/0/pstore.rbs +35 -30
  231. data/stdlib/psych/0/psych.rbs +62 -9
  232. data/stdlib/psych/0/store.rbs +2 -4
  233. data/stdlib/pty/0/pty.rbs +9 -6
  234. data/stdlib/random-formatter/0/random-formatter.rbs +277 -0
  235. data/stdlib/rdoc/0/code_object.rbs +2 -1
  236. data/stdlib/rdoc/0/parser.rbs +1 -1
  237. data/stdlib/rdoc/0/store.rbs +1 -1
  238. data/stdlib/ripper/0/ripper.rbs +20 -17
  239. data/stdlib/securerandom/0/manifest.yaml +2 -0
  240. data/stdlib/securerandom/0/securerandom.rbs +7 -20
  241. data/stdlib/shellwords/0/shellwords.rbs +2 -2
  242. data/stdlib/socket/0/addrinfo.rbs +9 -9
  243. data/stdlib/socket/0/basic_socket.rbs +3 -3
  244. data/stdlib/socket/0/ip_socket.rbs +10 -8
  245. data/stdlib/socket/0/socket.rbs +10 -9
  246. data/stdlib/socket/0/tcp_server.rbs +1 -1
  247. data/stdlib/socket/0/tcp_socket.rbs +1 -1
  248. data/stdlib/socket/0/udp_socket.rbs +1 -1
  249. data/stdlib/socket/0/unix_server.rbs +1 -1
  250. data/stdlib/stringio/0/stringio.rbs +55 -54
  251. data/stdlib/strscan/0/string_scanner.rbs +46 -44
  252. data/stdlib/tempfile/0/tempfile.rbs +24 -20
  253. data/stdlib/time/0/time.rbs +7 -5
  254. data/stdlib/tsort/0/tsort.rbs +7 -6
  255. data/stdlib/uri/0/common.rbs +31 -18
  256. data/stdlib/uri/0/file.rbs +2 -2
  257. data/stdlib/uri/0/generic.rbs +9 -2
  258. data/stdlib/uri/0/http.rbs +2 -2
  259. data/stdlib/uri/0/ldap.rbs +2 -2
  260. data/stdlib/uri/0/mailto.rbs +3 -3
  261. data/stdlib/uri/0/rfc2396_parser.rbs +6 -5
  262. data/stdlib/zlib/0/deflate.rbs +4 -3
  263. data/stdlib/zlib/0/gzip_reader.rbs +6 -6
  264. data/stdlib/zlib/0/gzip_writer.rbs +14 -12
  265. data/stdlib/zlib/0/inflate.rbs +1 -1
  266. data/stdlib/zlib/0/need_dict.rbs +1 -1
  267. metadata +66 -3
@@ -6,8 +6,8 @@
6
6
  # * StringIO.new: returns a new StringIO object containing the given string.
7
7
  # * StringIO.open: passes a new StringIO object to the given block.
8
8
  # Like an IO stream, a StringIO stream has certain properties:
9
- # * **Read/write mode**: whether the stream may be read, written, appended to,
10
- # etc.;
9
+ # * <strong>Read/write mode</strong>: whether the stream may be read, written,
10
+ # appended to, etc.;
11
11
  # see [Read/Write Mode](rdoc-ref:StringIO@Read-2FWrite+Mode).
12
12
  # * **Data mode**: text-only or binary;
13
13
  # see [Data Mode](rdoc-ref:StringIO@Data+Mode).
@@ -18,8 +18,8 @@
18
18
  # * **Line number**: a special, line-oriented, "position" (different from the
19
19
  # position mentioned above);
20
20
  # see [Line Number](rdoc-ref:StringIO@Line+Number).
21
- # * **Open/closed**: whether the stream is open or closed, for reading or
22
- # writing.
21
+ # * <strong>Open/closed</strong>: whether the stream is open or closed, for
22
+ # reading or writing.
23
23
  # see [Open/Closed Streams](rdoc-ref:StringIO@Open-2FClosed+Streams).
24
24
  # * **BOM**: byte mark order;
25
25
  # see [Byte Order Mark](rdoc-ref:StringIO@BOM+-28Byte+Order+Mark-29).
@@ -39,24 +39,24 @@
39
39
  # ## Stream Properties
40
40
  # ### Read/Write Mode
41
41
  # #### Summary
42
- # Mode |Initial Clear?| Read | Write
43
- # -------------------|--------------|--------|--------
44
- # `'r'`: read-only | No |Anywhere| Error
45
- # `'w'`: write-only | Yes | Error |Anywhere
46
- # `'a'`: append-only | No | Error |End only
47
- # `'r+'`: read/write | No |Anywhere|Anywhere
48
- # `'w+'`: read-write | Yes |Anywhere|Anywhere
49
- # `'a+'`: read/append| No |Anywhere|End only
42
+ # Mode |Initial Clear?| Read | Write
43
+ # ------------------------------|--------------|--------|--------
44
+ # <code>'r'</code>: read-only | No |Anywhere| Error
45
+ # <code>'w'</code>: write-only | Yes | Error |Anywhere
46
+ # <code>'a'</code>: append-only | No | Error |End only
47
+ # <code>'r+'</code>: read/write | No |Anywhere|Anywhere
48
+ # <code>'w+'</code>: read-write | Yes |Anywhere|Anywhere
49
+ # <code>'a+'</code>: read/append| No |Anywhere|End only
50
50
  # Each section below describes a read/write mode.
51
51
  # Any of the modes may be given as a string or as file constants;
52
52
  # example:
53
53
  # strio = StringIO.new('foo', 'a')
54
54
  # strio = StringIO.new('foo', File::WRONLY | File::APPEND)
55
55
  #
56
- # #### `'r'`: Read-Only
56
+ # #### <code>'r'</code>: Read-Only
57
57
  # Mode specified as one of:
58
- # * String: `'r'`.
59
- # * Constant: `File::RDONLY`.
58
+ # * String: <code>'r'</code>.
59
+ # * Constant: <code>File::RDONLY</code>.
60
60
  # Initial state:
61
61
  # strio = StringIO.new('foobarbaz', 'r')
62
62
  # strio.pos # => 0 # Beginning-of-stream.
@@ -71,10 +71,10 @@
71
71
  # May not be written:
72
72
  # strio.write('foo') # Raises IOError: not opened for writing
73
73
  #
74
- # #### `'w'`: Write-Only
74
+ # #### <code>'w'</code>: Write-Only
75
75
  # Mode specified as one of:
76
- # * String: `'w'`.
77
- # * Constant: `File::WRONLY`.
76
+ # * String: <code>'w'</code>.
77
+ # * Constant: <code>File::WRONLY</code>.
78
78
  # Initial state:
79
79
  # strio = StringIO.new('foo', 'w')
80
80
  # strio.pos # => 0 # Beginning of stream.
@@ -96,10 +96,10 @@
96
96
  # May not be read:
97
97
  # strio.read # Raises IOError: not opened for reading
98
98
  #
99
- # #### `'a'`: Append-Only
99
+ # #### <code>'a'</code>: Append-Only
100
100
  # Mode specified as one of:
101
- # * String: `'a'`.
102
- # * Constant: `File::WRONLY | File::APPEND`.
101
+ # * String: <code>'a'</code>.
102
+ # * Constant: <code>File::WRONLY | File::APPEND</code>.
103
103
  # Initial state:
104
104
  # strio = StringIO.new('foo', 'a')
105
105
  # strio.pos # => 0 # Beginning-of-stream.
@@ -117,10 +117,10 @@
117
117
  # May not be read:
118
118
  # strio.gets # Raises IOError: not opened for reading
119
119
  #
120
- # #### `'r+'`: Read/Write
120
+ # #### <code>'r+'</code>: Read/Write
121
121
  # Mode specified as one of:
122
- # * String: `'r+'`.
123
- # * Constant: `File::RDRW`.
122
+ # * String: <code>'r+'</code>.
123
+ # * Constant: <code>File::RDRW</code>.
124
124
  # Initial state:
125
125
  # strio = StringIO.new('foobar', 'r+')
126
126
  # strio.pos # => 0 # Beginning-of-stream.
@@ -145,10 +145,10 @@
145
145
  # strio.pos = 400
146
146
  # strio.gets(3) # => nil
147
147
  #
148
- # #### `'w+'`: Read/Write (Initially Clear)
148
+ # #### <code>'w+'</code>: Read/Write (Initially Clear)
149
149
  # Mode specified as one of:
150
- # * String: `'w+'`.
151
- # * Constant: `File::RDWR | File::TRUNC`.
150
+ # * String: <code>'w+'</code>.
151
+ # * Constant: <code>File::RDWR | File::TRUNC</code>.
152
152
  # Initial state:
153
153
  # strio = StringIO.new('foo', 'w+')
154
154
  # strio.pos # => 0 # Beginning-of-stream.
@@ -177,10 +177,10 @@
177
177
  # strio.pos = 400
178
178
  # strio.gets(3) # => nil
179
179
  #
180
- # #### `'a+'`: Read/Append
180
+ # #### <code>'a+'</code>: Read/Append
181
181
  # Mode specified as one of:
182
- # * String: `'a+'`.
183
- # * Constant: `File::RDWR | File::APPEND`.
182
+ # * String: <code>'a+'</code>.
183
+ # * Constant: <code>File::RDWR | File::APPEND</code>.
184
184
  # Initial state:
185
185
  # strio = StringIO.new('foo', 'a+')
186
186
  # strio.pos # => 0 # Beginning-of-stream.
@@ -208,9 +208,9 @@
208
208
  # To specify whether the stream is to be treated as text or as binary data,
209
209
  # either of the following may be suffixed to any of the string read/write modes
210
210
  # above:
211
- # * `'t'`: Text;
211
+ # * <code>'t'</code>: Text;
212
212
  # initializes the encoding as Encoding::UTF_8.
213
- # * `'b'`: Binary;
213
+ # * <code>'b'</code>: Binary;
214
214
  # initializes the encoding as Encoding::ASCII_8BIT.
215
215
  # If neither is given, the stream defaults to text data.
216
216
  # Examples:
@@ -231,12 +231,12 @@
231
231
  # .
232
232
  # The initial encoding for a new or re-opened stream depends on its [data
233
233
  # mode](rdoc-ref:StringIO@Data+Mode):
234
- # * Text: `Encoding::UTF_8`.
235
- # * Binary: `Encoding::ASCII_8BIT`.
234
+ # * Text: <code>Encoding::UTF_8</code>.
235
+ # * Binary: <code>Encoding::ASCII_8BIT</code>.
236
236
  # These instance methods are relevant:
237
237
  # * #external_encoding: returns the current encoding of the stream as an
238
238
  # `Encoding` object.
239
- # * #internal_encoding: returns `nil`; a stream does not have an internal
239
+ # * #internal_encoding: returns +nil+; a stream does not have an internal
240
240
  # encoding.
241
241
  # * #set_encoding: sets the encoding for the stream.
242
242
  # * #set_encoding_by_bom: sets the encoding for the stream to the stream's BOM
@@ -371,7 +371,7 @@
371
371
  # * Method #lineno= sets the line number.
372
372
  # The line number can be affected by reading (but never by writing);
373
373
  # in general, the line number is incremented each time the record separator
374
- # (default: `"\n"`) is read.
374
+ # (default: <code>"\n"</code>) is read.
375
375
  # Examples:
376
376
  # strio = StringIO.new(TEXT)
377
377
  # strio.string # => "First line\nSecond line\n\nFourth line\nFifth line\n"
@@ -522,7 +522,7 @@ class StringIO
522
522
  # strio.closed_write? # => false
523
523
  # strio.close
524
524
  #
525
- # If `string` is frozen, the default `mode` is `'r'`:
525
+ # If `string` is frozen, the default `mode` is <code>'r'</code>:
526
526
  #
527
527
  # strio = StringIO.new('foo'.freeze)
528
528
  # strio.string # => "foo"
@@ -546,7 +546,8 @@ class StringIO
546
546
  # - StringIO.open(string = '', mode = 'r+') -> new_stringio
547
547
  # - StringIO.open(string = '', mode = 'r+') {|strio| ... } -> object
548
548
  # -->
549
- # Creates new StringIO instance by calling `StringIO.new(string, mode)`.
549
+ # Creates new StringIO instance by calling <code>StringIO.new(string,
550
+ # mode)</code>.
550
551
  #
551
552
  # With no block given, returns the new instance:
552
553
  #
@@ -685,7 +686,7 @@ class StringIO
685
686
  # **No Arguments**
686
687
  # With no arguments given,
687
688
  # reads lines using the default record separator
688
- # (global variable `$/`, whose initial value is `"\n"`).
689
+ # (global variable <code>$/</code>, whose initial value is <code>"\n"</code>).
689
690
  # strio = StringIO.new(TEXT)
690
691
  # strio.each_line {|line| p line }
691
692
  # strio.eof? # => true
@@ -697,7 +698,7 @@ class StringIO
697
698
  # "Fourth line\n"
698
699
  # "Fifth line\n"
699
700
  #
700
- # **Argument `sep`**
701
+ # <strong>Argument `sep`</strong>
701
702
  # With only string argument `sep` given,
702
703
  # reads lines using that string as the record separator:
703
704
  # strio = StringIO.new(TEXT)
@@ -710,7 +711,7 @@ class StringIO
710
711
  # "line\nFifth "
711
712
  # "line\n"
712
713
  #
713
- # **Argument `limit`**
714
+ # <strong>Argument `limit`</strong>
714
715
  # With only integer argument `limit` given,
715
716
  # reads lines using the default record separator;
716
717
  # also limits the size (in characters) of each line to the given limit:
@@ -728,7 +729,7 @@ class StringIO
728
729
  # "Fifth line"
729
730
  # "\n"
730
731
  #
731
- # **Arguments `sep` and `limit`**
732
+ # <strong>Arguments `sep` and `limit`</strong>
732
733
  # With arguments `sep` and `limit` both given,
733
734
  # honors both:
734
735
  # strio = StringIO.new(TEXT)
@@ -793,7 +794,7 @@ class StringIO
793
794
  # Output:
794
795
  # "First line\nSecond line\n\nFourth line\nFifth line\n"
795
796
  #
796
- # **Keyword Argument `chomp`**
797
+ # <strong>Keyword Argument `chomp`</strong>
797
798
  # With keyword argument `chomp` given as `true` (the default is `false`),
798
799
  # removes trailing newline (if any) from each line:
799
800
  # strio = StringIO.new(TEXT)
@@ -1085,10 +1086,10 @@ class StringIO
1085
1086
  # Side effects:
1086
1087
  #
1087
1088
  # * Increments stream position by the number of bytes read.
1088
- # * Assigns the return value to global variable `$_`.
1089
+ # * Assigns the return value to global variable <code>$_</code>.
1089
1090
  #
1090
1091
  # With no arguments given, reads a line using the default record separator
1091
- # (global variable `$/`,* whose initial value is `"\n"`):
1092
+ # (global variable <code>$/</code>,* whose initial value is <code>"\n"</code>):
1092
1093
  #
1093
1094
  # strio = StringIO.new(TEXT)
1094
1095
  # strio.pos # => 0
@@ -1105,7 +1106,7 @@ class StringIO
1105
1106
  # strio.gets # => "Привет"
1106
1107
  # strio.pos # => 12
1107
1108
  #
1108
- # **Argument `sep`**
1109
+ # <strong>Argument `sep`</strong>
1109
1110
  #
1110
1111
  # With only string argument `sep` given, reads a line using that string as the
1111
1112
  # record separator:
@@ -1115,7 +1116,7 @@ class StringIO
1115
1116
  # strio.gets(' ') # => "line\nSecond "
1116
1117
  # strio.gets(' ') # => "line\n\nFourth "
1117
1118
  #
1118
- # **Argument `limit`**
1119
+ # <strong>Argument `limit`</strong>
1119
1120
  #
1120
1121
  # With only integer argument `limit` given, reads a line using the default
1121
1122
  # record separator; limits the size (in characters) of each line to the given
@@ -1127,7 +1128,7 @@ class StringIO
1127
1128
  # strio.gets(10) # => "Second lin"
1128
1129
  # strio.gets(10) # => "e\n"
1129
1130
  #
1130
- # **Arguments `sep` and `limit`**
1131
+ # <strong>Arguments `sep` and `limit`</strong>
1131
1132
  #
1132
1133
  # With arguments `sep` and `limit` both given, honors both:
1133
1134
  #
@@ -1170,7 +1171,7 @@ class StringIO
1170
1171
  # strio.gets(nil) # "Slurp": read all.
1171
1172
  # # => "First line\nSecond line\n\nFourth line\nFifth line\n"
1172
1173
  #
1173
- # **Keyword Argument `chomp`**
1174
+ # <strong>Keyword Argument `chomp`</strong>
1174
1175
  #
1175
1176
  # With keyword argument `chomp` given as `true` (the default is `false`),
1176
1177
  # removes the trailing newline (if any) from the returned line:
@@ -1507,7 +1508,7 @@ class StringIO
1507
1508
  # **No Arguments**
1508
1509
  # With no arguments given,
1509
1510
  # reads lines using the default record separator
1510
- # (global variable `$/`, whose initial value is `"\n"`).
1511
+ # (global variable <code>$/</code>, whose initial value is <code>"\n"</code>).
1511
1512
  # strio = StringIO.new(TEXT)
1512
1513
  # strio.each_line {|line| p line }
1513
1514
  # strio.eof? # => true
@@ -1519,7 +1520,7 @@ class StringIO
1519
1520
  # "Fourth line\n"
1520
1521
  # "Fifth line\n"
1521
1522
  #
1522
- # **Argument `sep`**
1523
+ # <strong>Argument `sep`</strong>
1523
1524
  # With only string argument `sep` given,
1524
1525
  # reads lines using that string as the record separator:
1525
1526
  # strio = StringIO.new(TEXT)
@@ -1532,7 +1533,7 @@ class StringIO
1532
1533
  # "line\nFifth "
1533
1534
  # "line\n"
1534
1535
  #
1535
- # **Argument `limit`**
1536
+ # <strong>Argument `limit`</strong>
1536
1537
  # With only integer argument `limit` given,
1537
1538
  # reads lines using the default record separator;
1538
1539
  # also limits the size (in characters) of each line to the given limit:
@@ -1550,7 +1551,7 @@ class StringIO
1550
1551
  # "Fifth line"
1551
1552
  # "\n"
1552
1553
  #
1553
- # **Arguments `sep` and `limit`**
1554
+ # <strong>Arguments `sep` and `limit`</strong>
1554
1555
  # With arguments `sep` and `limit` both given,
1555
1556
  # honors both:
1556
1557
  # strio = StringIO.new(TEXT)
@@ -1615,7 +1616,7 @@ class StringIO
1615
1616
  # Output:
1616
1617
  # "First line\nSecond line\n\nFourth line\nFifth line\n"
1617
1618
  #
1618
- # **Keyword Argument `chomp`**
1619
+ # <strong>Keyword Argument `chomp`</strong>
1619
1620
  # With keyword argument `chomp` given as `true` (the default is `false`),
1620
1621
  # removes trailing newline (if any) from each line:
1621
1622
  # strio = StringIO.new(TEXT)
@@ -1,6 +1,7 @@
1
1
  # <!-- rdoc-file=ext/strscan/strscan.c -->
2
2
  # Class `StringScanner` supports processing a stored string as a stream;
3
- # this code creates a new `StringScanner` object with string `'foobarbaz'`:
3
+ # this code creates a new `StringScanner` object with string
4
+ # <code>'foobarbaz'</code>:
4
5
  # require 'strscan'
5
6
  # scanner = StringScanner.new('foobarbaz')
6
7
  #
@@ -19,13 +20,13 @@
19
20
  # ENGLISH_TEXT = 'Hello'
20
21
  #
21
22
  # Some examples here assume that certain helper methods are defined:
22
- # * `put_situation(scanner)`:
23
+ # * <code>put_situation(scanner)</code>:
23
24
  # Displays the values of the scanner's
24
25
  # methods #pos, #charpos, #rest, and #rest_size.
25
- # * `put_match_values(scanner)`:
26
+ # * <code>put_match_values(scanner)</code>:
26
27
  # Displays the scanner's [match
27
28
  # values](rdoc-ref:StringScanner@Match+Values).
28
- # * `match_values_cleared?(scanner)`:
29
+ # * <code>match_values_cleared?(scanner)</code>:
29
30
  # Returns whether the scanner's [match
30
31
  # values](rdoc-ref:StringScanner@Match+Values) are cleared.
31
32
  # See examples at [helper methods](helper_methods.md).
@@ -45,7 +46,7 @@
45
46
  # The scanner has:
46
47
  # * A *stored string*, which is:
47
48
  # * Initially set by StringScanner.new(string) to the given `string`
48
- # (`'foobarbaz'` in the example above).
49
+ # (<code>'foobarbaz'</code> in the example above).
49
50
  # * Modifiable by methods #string=(new_string) and #concat(more_string).
50
51
  # * Returned by method #string.
51
52
  # More at [Stored String](rdoc-ref:StringScanner@Stored+String) below.
@@ -63,7 +64,7 @@
63
64
  # which is a trailing substring of the stored string;
64
65
  # it extends from the current position to the end of the stored string:
65
66
  # * Initially set by StringScanner.new(string) to the given `string`
66
- # (`'foobarbaz'` in the example above).
67
+ # (<code>'foobarbaz'</code> in the example above).
67
68
  # * Returned by method #rest.
68
69
  # * Modified by any modification to either the stored string or the
69
70
  # position.
@@ -96,7 +97,7 @@
96
97
  # When the byte position is:
97
98
  # * Zero (at the beginning), the target substring is the entire stored string.
98
99
  # * Equal to the size of the stored string (at the end),
99
- # the target substring is the empty string `''`.
100
+ # the target substring is the empty string <code>''</code>.
100
101
  # To get or set the byte position:
101
102
  # * #pos: returns the byte position.
102
103
  # * #pos=(new_pos): sets the byte position.
@@ -120,7 +121,7 @@
120
121
  # * #charpos: the [character
121
122
  # position](rdoc-ref:StringScanner@Character+Position).
122
123
  # * #rest: the [target substring](rdoc-ref:StringScanner@Target+Substring).
123
- # * #rest_size: `rest.size`.
124
+ # * #rest_size: <code>rest.size</code>.
124
125
  # ### Character Position
125
126
  # The character position is a zero-based index into the *characters*
126
127
  # in the stored string;
@@ -211,12 +212,12 @@
211
212
  # This table summarizes (details and examples at the links):
212
213
  # Method | Returns |Sets Match Values?
213
214
  # ---------------------|---------------------------------------------|------------------
214
- # #check(pattern) | Matched leading substring or `nil`. | Yes.
215
- # #check_until(pattern)| Matched substring (anywhere) or `nil`. | Yes.
215
+ # #check(pattern) | Matched leading substring or +nil+. | Yes.
216
+ # #check_until(pattern)| Matched substring (anywhere) or +nil+. | Yes.
216
217
  # #exist?(pattern) | Matched substring (anywhere) end index. | Yes.
217
- # #match?(pattern) | Size of matched leading substring or `nil`. | Yes.
218
+ # #match?(pattern) | Size of matched leading substring or +nil+. | Yes.
218
219
  # #peek(size) | Leading substring of given length (bytes). | No.
219
- # #peek_byte | Integer leading byte or `nil`. | No.
220
+ # #peek_byte | Integer leading byte or +nil+. | No.
220
221
  # #rest |Target substring (from byte position to end).| No.
221
222
  # ### Traversing the Target Substring
222
223
  # A *traversal* method examines the target substring,
@@ -226,24 +227,24 @@
226
227
  # This table summarizes (details and examples at links):
227
228
  # Method | Returns |Sets Match Values?
228
229
  # --------------------|----------------------------------------------------|------------------
229
- # #get_byte | Leading byte or `nil`. | No.
230
- # #getch | Leading character or `nil`. | No.
231
- # #scan(pattern) | Matched leading substring or `nil`. | Yes.
232
- # #scan_byte | Integer leading byte or `nil`. | No.
233
- # #scan_until(pattern)| Matched substring (anywhere) or `nil`. | Yes.
234
- # #skip(pattern) | Matched leading substring size or `nil`. | Yes.
235
- # #skip_until(pattern)|Position delta to end-of-matched-substring or `nil`.| Yes.
236
- # #unscan | `self`. | No.
230
+ # #get_byte | Leading byte or +nil+. | No.
231
+ # #getch | Leading character or +nil+. | No.
232
+ # #scan(pattern) | Matched leading substring or +nil+. | Yes.
233
+ # #scan_byte | Integer leading byte or +nil+. | No.
234
+ # #scan_until(pattern)| Matched substring (anywhere) or +nil+. | Yes.
235
+ # #skip(pattern) | Matched leading substring size or +nil+. | Yes.
236
+ # #skip_until(pattern)|Position delta to end-of-matched-substring or +nil+.| Yes.
237
+ # #unscan | +self+. | No.
237
238
  # ## Querying the Scanner
238
239
  # Each of these methods queries the scanner object
239
240
  # without modifying it (details and examples at links)
240
241
  # Method | Returns
241
242
  # -------------------|--------------------------------
242
- # #beginning_of_line?| `true` or `false`.
243
+ # #beginning_of_line?| +true+ or +false+.
243
244
  # #charpos | Character position.
244
- # #eos? | `true` or `false`.
245
- # #fixed_anchor? | `true` or `false`.
246
- # #inspect |String representation of `self`.
245
+ # #eos? | +true+ or +false+.
246
+ # #fixed_anchor? | +true+ or +false+.
247
+ # #inspect |String representation of +self+.
247
248
  # #pos | Byte position.
248
249
  # #rest | Target substring.
249
250
  # #rest_size | Size of target substring.
@@ -290,7 +291,7 @@
290
291
  # generally contain the results of the most recent attempted match.
291
292
  # Each match value may be thought of as:
292
293
  # * *Clear*: Initially, or after an unsuccessful match attempt:
293
- # usually, `false`, `nil`, or `{}`.
294
+ # usually, `false`, `nil`, or <code>{}</code>.
294
295
  # * *Set*: After a successful match attempt:
295
296
  # `true`, string, array, or hash.
296
297
  # Each of these methods clears match values:
@@ -312,11 +313,11 @@
312
313
  # Each of these methods returns a basic match value:
313
314
  # Method | Return After Match |Return After No Match
314
315
  # -------------|--------------------------------------|---------------------
315
- # #matched? | `true`. | `false`.
316
- # #matched_size| Size of matched substring. | `nil`.
317
- # #matched | Matched substring. | `nil`.
318
- # #pre_match |Substring preceding matched substring.| `nil`.
319
- # #post_match |Substring following matched substring.| `nil`.
316
+ # #matched? | +true+. | +false+.
317
+ # #matched_size| Size of matched substring. | +nil+.
318
+ # #matched | Matched substring. | +nil+.
319
+ # #pre_match |Substring preceding matched substring.| +nil+.
320
+ # #post_match |Substring following matched substring.| +nil+.
320
321
  #
321
322
  # See examples below.
322
323
  # #### Captured Match Values
@@ -326,11 +327,11 @@
326
327
  # Each of these methods returns a captured match value:
327
328
  # Method | Return After Match |Return After No Match
328
329
  # ---------------|---------------------------------------|---------------------
329
- # #size | Count of captured substrings. | `nil`.
330
- # #[](n) | `n`th captured substring. | `nil`.
331
- # #captures | Array of all captured substrings. | `nil`.
332
- # #values_at(*n) |Array of specified captured substrings.| `nil`.
333
- # #named_captures| Hash of named captures. | `{}`.
330
+ # #size | Count of captured substrings. | +nil+.
331
+ # #[](n) | `n`th captured substring. | +nil+.
332
+ # #captures | Array of all captured substrings. | +nil+.
333
+ # #values_at(*n) |Array of specified captured substrings.| +nil+.
334
+ # #named_captures| Hash of named captures. | <code>{}</code>.
334
335
  #
335
336
  # See examples below.
336
337
  # #### Match Values Examples
@@ -401,7 +402,7 @@
401
402
  # ## Fixed-Anchor Property
402
403
  # Pattern matching in `StringScanner` is the same as in Ruby's,
403
404
  # except for its fixed-anchor property,
404
- # which determines the meaning of `'\A'`:
405
+ # which determines the meaning of <code>'\A'</code>:
405
406
  # * `false` (the default): matches the current byte position.
406
407
  # scanner = StringScanner.new('foobar')
407
408
  # scanner.scan(/\A./) # => "f"
@@ -486,13 +487,13 @@ class StringScanner
486
487
  # scanner[:day] # => "12"
487
488
  # scanner[:nope] # => nil
488
489
  #
489
- # When there are no captures, only `[0]` returns non-`nil`:
490
+ # When there are no captures, only <code>[0]</code> returns non-`nil`:
490
491
  # scanner = StringScanner.new('foobarbaz')
491
492
  # scanner.exist?(/bar/)
492
493
  # scanner[0] # => "bar"
493
494
  # scanner[1] # => nil
494
495
  #
495
- # For a failed match, even `[0]` returns `nil`:
496
+ # For a failed match, even <code>[0]</code> returns `nil`:
496
497
  # scanner.scan(/nope/) # => nil
497
498
  # scanner[0] # => nil
498
499
  # scanner[1] # => nil
@@ -539,7 +540,8 @@ class StringScanner
539
540
  # - captures -> substring_array or nil
540
541
  # -->
541
542
  # Returns the array of [captured match
542
- # values](rdoc-ref:StringScanner@Captured+Match+Values) at indexes `(1..)`
543
+ # values](rdoc-ref:StringScanner@Captured+Match+Values) at indexes
544
+ # <code>(1..)</code>
543
545
  # if the most recent match attempt succeeded, or `nil` otherwise:
544
546
  # scanner = StringScanner.new('Fri Dec 12 1975 14:39')
545
547
  # scanner.captures # => nil
@@ -999,7 +1001,7 @@ class StringScanner
999
1001
  # rdoc-file=ext/strscan/strscan.c
1000
1002
  # - peek(length) -> substring
1001
1003
  # -->
1002
- # Returns the substring `string[pos, length]`;
1004
+ # Returns the substring <code>string[pos, length]</code>;
1003
1005
  # does not update [match values](rdoc-ref:StringScanner@Match+Values) or
1004
1006
  # [positions](rdoc-ref:StringScanner@Positions):
1005
1007
  # scanner = StringScanner.new('foobarbaz')
@@ -1151,7 +1153,7 @@ class StringScanner
1151
1153
  # Sets both [byte position](rdoc-ref:StringScanner@Byte+Position+-28Position-29)
1152
1154
  # and [character position](rdoc-ref:StringScanner@Character+Position) to zero,
1153
1155
  # and clears [match values](rdoc-ref:StringScanner@Match+Values);
1154
- # returns `self`:
1156
+ # returns +self+:
1155
1157
  # scanner = StringScanner.new('foobarbaz')
1156
1158
  # scanner.exist?(/bar/) # => 6
1157
1159
  # scanner.reset # => #<StringScanner 0/9 @ "fooba...">
@@ -1237,7 +1239,7 @@ class StringScanner
1237
1239
  # * Returns the matched substring.
1238
1240
  # * Increments the [byte
1239
1241
  # position](rdoc-ref:StringScanner@Byte+Position+-28Position-29) by
1240
- # `substring.bytesize`,
1242
+ # <code>substring.bytesize</code>,
1241
1243
  # and may increment the [character
1242
1244
  # position](rdoc-ref:StringScanner@Character+Position).
1243
1245
  # * Sets [match values](rdoc-ref:StringScanner@Match+Values).
@@ -1517,7 +1519,7 @@ class StringScanner
1517
1519
  # call-seq:
1518
1520
  # terminate -> self
1519
1521
  # Sets the scanner to end-of-string;
1520
- # returns `self`:
1522
+ # returns +self+:
1521
1523
  # * Sets both [positions](rdoc-ref:StringScanner@Positions) to end-of-stream.
1522
1524
  # * Clears [match values](rdoc-ref:StringScanner@Match+Values).
1523
1525
  # scanner = StringScanner.new(HIRAGANA_TEXT)
@@ -1578,7 +1580,7 @@ class StringScanner
1578
1580
  # - values_at(*specifiers) -> array_of_captures or nil
1579
1581
  # -->
1580
1582
  # Returns an array of captured substrings, or `nil` of none.
1581
- # For each `specifier`, the returned substring is `[specifier]`;
1583
+ # For each `specifier`, the returned substring is <code>[specifier]</code>;
1582
1584
  # see #[].
1583
1585
  # scanner = StringScanner.new('Fri Dec 12 1975 14:39')
1584
1586
  # pattern = /(?<wday>\w+) (?<month>\w+) (?<day>\d+) /
@@ -159,7 +159,7 @@ class Tempfile < File
159
159
  # * Generated filename is unique in that directory.
160
160
  # * Permissions are `0600`; see [File
161
161
  # Permissions](rdoc-ref:File@File+Permissions).
162
- # * Mode is `'w+'` (read/write mode, positioned at the end).
162
+ # * Mode is <code>'w+'</code> (read/write mode, positioned at the end).
163
163
  #
164
164
  # The temporary file removal depends on the keyword argument `anonymous` and
165
165
  # whether a block is given or not. See the description about the `anonymous`
@@ -206,8 +206,8 @@ class Tempfile < File
206
206
  #
207
207
  # Tempfile.create('foo') # => #<File:/tmp/foo20220505-9795-1gok8l9>
208
208
  #
209
- # * An array of two strings `[prefix, suffix]`: the generated filename begins
210
- # with `prefix` and ends with `suffix`:
209
+ # * An array of two strings <code>[prefix, suffix]</code>: the generated
210
+ # filename begins with `prefix` and ends with `suffix`:
211
211
  #
212
212
  # Tempfile.create(%w/foo .jpg/) # => #<File:/tmp/foo20220505-17839-tnjchh.jpg>
213
213
  #
@@ -226,16 +226,19 @@ class Tempfile < File
226
226
  #
227
227
  # The keyword argument `anonymous` specifies when the file is removed.
228
228
  #
229
- # * `anonymous=false` (default) without a block: the file is not removed.
230
- # * `anonymous=false` (default) with a block: the file is removed after the
231
- # block exits.
232
- # * `anonymous=true` without a block: the file is removed before returning.
233
- # * `anonymous=true` with a block: the file is removed before the block is
234
- # called.
229
+ # * <code>anonymous=false</code> (default) without a block: the file is not
230
+ # removed.
231
+ # * <code>anonymous=false</code> (default) with a block: the file is removed
232
+ # after the block exits.
233
+ # * <code>anonymous=true</code> without a block: the file is removed before
234
+ # returning.
235
+ # * <code>anonymous=true</code> with a block: the file is removed before the
236
+ # block is called.
235
237
  #
236
- # In the first case (`anonymous=false` without a block), the file is not removed
237
- # automatically. It should be explicitly closed. It can be used to rename to the
238
- # desired filename. If the file is not needed, it should be explicitly removed.
238
+ # In the first case (<code>anonymous=false</code> without a block), the file is
239
+ # not removed automatically. It should be explicitly closed. It can be used to
240
+ # rename to the desired filename. If the file is not needed, it should be
241
+ # explicitly removed.
239
242
  #
240
243
  # The File#path method of the created file object returns the temporary
241
244
  # directory with a trailing slash when `anonymous` is true.
@@ -248,8 +251,8 @@ class Tempfile < File
248
251
  #
249
252
  # Implementation note:
250
253
  #
251
- # The keyword argument `anonymous=true` is implemented using `FILE_SHARE_DELETE`
252
- # on Windows. `O_TMPFILE` is used on Linux.
254
+ # The keyword argument <code>anonymous=true</code> is implemented using
255
+ # `FILE_SHARE_DELETE` on Windows. `O_TMPFILE` is used on Linux.
253
256
  #
254
257
  # Related: Tempfile.new.
255
258
  #
@@ -283,7 +286,8 @@ class Tempfile < File
283
286
  #
284
287
  # The call returns the value of the block.
285
288
  #
286
- # In any case, all arguments (`*args`) will be passed to Tempfile.new.
289
+ # In any case, all arguments (<code>*args</code>) will be passed to
290
+ # Tempfile.new.
287
291
  #
288
292
  # Tempfile.open('foo', '/home/temp') do |f|
289
293
  # # ... do something with f ...
@@ -318,7 +322,7 @@ class Tempfile < File
318
322
  # - close!()
319
323
  # -->
320
324
  # Closes and unlinks (deletes) the file. Has the same effect as called
321
- # `close(true)`.
325
+ # <code>close(true)</code>.
322
326
  #
323
327
  def close!: () -> void
324
328
 
@@ -422,7 +426,7 @@ class Tempfile < File
422
426
  # If possible, consider instead using Tempfile.create, which:
423
427
  #
424
428
  # * Avoids the performance cost of delegation, incurred when Tempfile.new
425
- # calls its superclass `DelegateClass(File)`.
429
+ # calls its superclass <code>DelegateClass(File)</code>.
426
430
  # * Does not rely on a finalizer to close and unlink the file, which can be
427
431
  # unreliable.
428
432
  #
@@ -433,7 +437,7 @@ class Tempfile < File
433
437
  # * Generated filename is unique in that directory.
434
438
  # * Permissions are `0600`; see [File
435
439
  # Permissions](rdoc-ref:File@File+Permissions).
436
- # * Mode is `'w+'` (read/write mode, positioned at the end).
440
+ # * Mode is <code>'w+'</code> (read/write mode, positioned at the end).
437
441
  #
438
442
  # The underlying file is removed when the Tempfile object dies and is reclaimed
439
443
  # by the garbage collector.
@@ -454,8 +458,8 @@ class Tempfile < File
454
458
  #
455
459
  # Tempfile.new('foo') # => #<Tempfile:/tmp/foo20220505-17839-1whk2f>
456
460
  #
457
- # * An array of two strings `[prefix, suffix]`: the generated filename begins
458
- # with `prefix` and ends with `suffix`:
461
+ # * An array of two strings <code>[prefix, suffix]</code>: the generated
462
+ # filename begins with `prefix` and ends with `suffix`:
459
463
  #
460
464
  # Tempfile.new(%w/foo .jpg/) # => #<Tempfile:/tmp/foo20220505-17839-58xtfi.jpg>
461
465
  #