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
@@ -4,7 +4,7 @@ module RBS
4
4
  # ## ARGF and `ARGV`
5
5
  #
6
6
  # The ARGF object works with the array at global variable `ARGV` to make
7
- # `$stdin` and file streams available in the Ruby program:
7
+ # <code>$stdin</code> and file streams available in the Ruby program:
8
8
  #
9
9
  # * **ARGV** may be thought of as the **argument vector** array.
10
10
  #
@@ -13,9 +13,9 @@ module RBS
13
13
  #
14
14
  # * **ARGF** may be thought of as the **argument files** object.
15
15
  #
16
- # It can access file streams and/or the `$stdin` stream, based on what it
17
- # finds in `ARGV`. This provides a convenient way for the command line to
18
- # specify streams for a Ruby program to read.
16
+ # It can access file streams and/or the <code>$stdin</code> stream, based on
17
+ # what it finds in `ARGV`. This provides a convenient way for the command
18
+ # line to specify streams for a Ruby program to read.
19
19
  #
20
20
  # ## Reading
21
21
  #
@@ -24,16 +24,16 @@ module RBS
24
24
  #
25
25
  # ### Simplest Case
26
26
  #
27
- # When the *very first* ARGF read occurs with an empty `ARGV` (`[]`), the source
28
- # is `$stdin`:
27
+ # When the *very first* ARGF read occurs with an empty `ARGV` (<code>[]</code>),
28
+ # the source is <code>$stdin</code>:
29
29
  #
30
- # * File `t.rb`:
30
+ # * File <code>t.rb</code>:
31
31
  #
32
32
  # p ['ARGV', ARGV]
33
33
  # p ['ARGF.read', ARGF.read]
34
34
  #
35
- # * Commands and outputs (see below for the content of files `foo.txt` and
36
- # `bar.txt`):
35
+ # * Commands and outputs (see below for the content of files
36
+ # <code>foo.txt</code> and <code>bar.txt</code>):
37
37
  #
38
38
  # $ echo "Open the pod bay doors, Hal." | ruby t.rb
39
39
  # ["ARGV", []]
@@ -45,7 +45,8 @@ module RBS
45
45
  #
46
46
  # ### About the Examples
47
47
  #
48
- # Many examples here assume the existence of files `foo.txt` and `bar.txt`:
48
+ # Many examples here assume the existence of files <code>foo.txt</code> and
49
+ # <code>bar.txt</code>:
49
50
  #
50
51
  # $ cat foo.txt
51
52
  # Foo 0
@@ -66,19 +67,20 @@ module RBS
66
67
  # one of:
67
68
  #
68
69
  # * The string path to a file that may be opened as a stream.
69
- # * The character `'-'`, meaning stream `$stdin`.
70
+ # * The character <code>'-'</code>, meaning stream <code>$stdin</code>.
70
71
  #
71
72
  # Each element that is *not* one of these should be removed from `ARGV` before
72
73
  # ARGF accesses that source.
73
74
  #
74
75
  # In the following example:
75
76
  #
76
- # * Filepaths `foo.txt` and `bar.txt` may be retained as potential sources.
77
- # * Options `--xyzzy` and `--mojo` should be removed.
77
+ # * Filepaths <code>foo.txt</code> and <code>bar.txt</code> may be retained as
78
+ # potential sources.
79
+ # * Options <code>--xyzzy</code> and <code>--mojo</code> should be removed.
78
80
  #
79
81
  # Example:
80
82
  #
81
- # * File `t.rb`:
83
+ # * File <code>t.rb</code>:
82
84
  #
83
85
  # # Print arguments (and options, if any) found on command line.
84
86
  # p ['ARGV', ARGV]
@@ -90,7 +92,7 @@ module RBS
90
92
  #
91
93
  # ARGF's stream access considers the elements of `ARGV`, left to right:
92
94
  #
93
- # * File `t.rb`:
95
+ # * File <code>t.rb</code>:
94
96
  #
95
97
  # p "ARGV: #{ARGV}"
96
98
  # p "Read: #{ARGF.read}" # Read everything from all specified streams.
@@ -112,7 +114,7 @@ module RBS
112
114
  # Each element in `ARGV` is removed when its corresponding source is accessed;
113
115
  # when all sources have been accessed, the array is empty:
114
116
  #
115
- # * File `t.rb`:
117
+ # * File <code>t.rb</code>:
116
118
  #
117
119
  # until ARGV.empty? && ARGF.eof?
118
120
  # p "ARGV: #{ARGV}"
@@ -142,7 +144,7 @@ module RBS
142
144
  # This program prints what it reads from files at the paths specified on the
143
145
  # command line:
144
146
  #
145
- # * File `t.rb`:
147
+ # * File <code>t.rb</code>:
146
148
  #
147
149
  # p ['ARGV', ARGV]
148
150
  # # Read and print all content from the specified sources.
@@ -154,11 +156,12 @@ module RBS
154
156
  # ["ARGV", [foo.txt, bar.txt]
155
157
  # ["ARGF.read", "Foo 0\nFoo 1\nBar 0\nBar 1\nBar 2\nBar 3\n"]
156
158
  #
157
- # #### Specifying `$stdin` in `ARGV`
159
+ # #### Specifying <code>$stdin</code> in `ARGV`
158
160
  #
159
- # To specify stream `$stdin` in `ARGV`, us the character `'-'`:
161
+ # To specify stream <code>$stdin</code> in `ARGV`, us the character
162
+ # <code>'-'</code>:
160
163
  #
161
- # * File `t.rb`:
164
+ # * File <code>t.rb</code>:
162
165
  #
163
166
  # p ['ARGV', ARGV]
164
167
  # p ['ARGF.read', ARGF.read]
@@ -169,8 +172,9 @@ module RBS
169
172
  # ["ARGV", ["-"]]
170
173
  # ["ARGF.read", "Open the pod bay doors, Hal.\n"]
171
174
  #
172
- # When no character `'-'` is given, stream `$stdin` is ignored (exception: see
173
- # [Specifying $stdin in ARGV](rdoc-ref:ARGF@Specifying+-24stdin+in+ARGV)):
175
+ # When no character <code>'-'</code> is given, stream <code>$stdin</code> is
176
+ # ignored (exception: see [Specifying $stdin in
177
+ # ARGV](rdoc-ref:ARGF@Specifying+-24stdin+in+ARGV)):
174
178
  #
175
179
  # * Command and output:
176
180
  #
@@ -181,7 +185,7 @@ module RBS
181
185
  # #### Mixtures and Repetitions in `ARGV`
182
186
  #
183
187
  # For an ARGF reader, `ARGV` may contain any mixture of filepaths and character
184
- # `'-'`, including repetitions.
188
+ # <code>'-'</code>, including repetitions.
185
189
  #
186
190
  # #### Modifications to `ARGV`
187
191
  #
@@ -208,13 +212,13 @@ module RBS
208
212
  # ### About Enumerable
209
213
  #
210
214
  # ARGF includes module Enumerable. Virtually all methods in Enumerable call
211
- # method `#each` in the including class.
215
+ # method <code>#each</code> in the including class.
212
216
  #
213
217
  # **Note well**: In ARGF, method #each returns data from the *sources*, *not*
214
- # from `ARGV`; therefore, for example, `ARGF#entries` returns an array of lines
215
- # from the sources, not an array of the strings from `ARGV`:
218
+ # from `ARGV`; therefore, for example, <code>ARGF#entries</code> returns an
219
+ # array of lines from the sources, not an array of the strings from `ARGV`:
216
220
  #
217
- # * File `t.rb`:
221
+ # * File <code>t.rb</code>:
218
222
  #
219
223
  # p ['ARGV', ARGV]
220
224
  # p ['ARGF.entries', ARGF.entries]
@@ -521,8 +525,8 @@ module RBS
521
525
  # rdoc-file=io.c
522
526
  # - ARGF.file -> IO or File object
523
527
  # -->
524
- # Returns the current file as an IO or File object. `$stdin` is returned when
525
- # the current file is STDIN.
528
+ # Returns the current file as an IO or File object. <code>$stdin</code> is
529
+ # returned when the current file is STDIN.
526
530
  #
527
531
  # For example:
528
532
  #
@@ -630,8 +634,9 @@ module RBS
630
634
  # -->
631
635
  # Returns the next line from the current file in ARGF.
632
636
  #
633
- # By default lines are assumed to be separated by `$/`; to use a different
634
- # character as a separator, supply it as a String for the *sep* argument.
637
+ # By default lines are assumed to be separated by <code>$/</code>; to use a
638
+ # different character as a separator, supply it as a String for the *sep*
639
+ # argument.
635
640
  #
636
641
  # The optional *limit* argument specifies how many characters of each line to
637
642
  # return. By default all characters are returned.
@@ -647,7 +652,7 @@ module RBS
647
652
  # -->
648
653
  # Returns the file extension appended to the names of backup copies of modified
649
654
  # files under in-place edit mode. This value can be set using ARGF.inplace_mode=
650
- # or passing the `-i` switch to the Ruby binary.
655
+ # or passing the <code>-i</code> switch to the Ruby binary.
651
656
  #
652
657
  %a{annotate:rdoc:copy:ARGF#inplace_mode}
653
658
  def inplace_mode: () -> String?
@@ -668,8 +673,9 @@ module RBS
668
673
  # print line.sub("foo","bar")
669
674
  # end
670
675
  #
671
- # First, *file.txt.bak* is created as a backup copy of *file.txt*. Then, each
672
- # line of *file.txt* has the first occurrence of "foo" replaced with "bar".
676
+ # First, <em>file.txt.bak</em> is created as a backup copy of <em>file.txt</em>.
677
+ # Then, each line of <em>file.txt</em> has the first occurrence of "foo"
678
+ # replaced with "bar".
673
679
  #
674
680
  %a{annotate:rdoc:copy:ARGF#inplace_mode=}
675
681
  def inplace_mode=: (String) -> self
@@ -684,10 +690,10 @@ module RBS
684
690
  # object.
685
691
  #
686
692
  # If ARGF.set_encoding has been called with two encoding names, the second is
687
- # returned. Otherwise, if `Encoding.default_external` has been set, that value
688
- # is returned. Failing that, if a default external encoding was specified on the
689
- # command-line, that value is used. If the encoding is unknown, `nil` is
690
- # returned.
693
+ # returned. Otherwise, if <code>Encoding.default_external</code> has been set,
694
+ # that value is returned. Failing that, if a default external encoding was
695
+ # specified on the command-line, that value is used. If the encoding is unknown,
696
+ # `nil` is returned.
691
697
  #
692
698
  %a{annotate:rdoc:copy:ARGF#internal_encoding}
693
699
  def internal_encoding: () -> Encoding
@@ -778,15 +784,15 @@ module RBS
778
784
  # - print(*objects) -> nil
779
785
  # -->
780
786
  # Writes the given objects to the stream; returns `nil`. Appends the output
781
- # record separator `$OUTPUT_RECORD_SEPARATOR` (`$\`), if it is not `nil`. See
782
- # [Line IO](rdoc-ref:IO@Line+IO).
787
+ # record separator <code>$OUTPUT_RECORD_SEPARATOR</code> (<code>$\</code>), if
788
+ # it is not `nil`. See [Line IO](rdoc-ref:IO@Line+IO).
783
789
  #
784
790
  # With argument `objects` given, for each object:
785
791
  #
786
792
  # * Converts via its method `to_s` if not a string.
787
793
  # * Writes to the stream.
788
794
  # * If not the last object, writes the output field separator
789
- # `$OUTPUT_FIELD_SEPARATOR` (`$,`) if it is not `nil`.
795
+ # <code>$OUTPUT_FIELD_SEPARATOR</code> (<code>$,</code>) if it is not `nil`.
790
796
  #
791
797
  # With default separators:
792
798
  #
@@ -818,8 +824,8 @@ module RBS
818
824
  #
819
825
  # "0,0.0,0/1,0+0i,zero,zero\n"
820
826
  #
821
- # With no argument given, writes the content of `$_` (which is usually the most
822
- # recent user input):
827
+ # With no argument given, writes the content of <code>$_</code> (which is
828
+ # usually the most recent user input):
823
829
  #
824
830
  # f = File.open('t.tmp', 'w+')
825
831
  # gets # Sets $_ to the most recent user input.
@@ -871,13 +877,13 @@ module RBS
871
877
  # newline sequence. If called without arguments, writes a newline. See [Line
872
878
  # IO](rdoc-ref:IO@Line+IO).
873
879
  #
874
- # Note that each added newline is the character `"\n"<//tt>, not the output
875
- # record separator (<tt>$\`).
880
+ # Note that each added newline is the character <code>"\n"<//tt>, not the output
881
+ # record separator (<tt>$\</code>).
876
882
  #
877
883
  # Treatment for each object:
878
884
  #
879
885
  # * String: writes the string.
880
- # * Neither string nor array: writes `object.to_s`.
886
+ # * Neither string nor array: writes <code>object.to_s</code>.
881
887
  # * Array: writes each element of the array; arrays may be nested.
882
888
  #
883
889
  # To keep these examples brief, we define this helper method:
@@ -930,7 +936,7 @@ module RBS
930
936
  # conversion is applied, if applicable. A string is returned even if EOF is
931
937
  # encountered before any data is read.
932
938
  #
933
- # If *length* is zero, it returns an empty string (`""`).
939
+ # If *length* is zero, it returns an empty string (<code>""</code>).
934
940
  #
935
941
  # If the optional *outbuf* argument is present, it must reference a String,
936
942
  # which will receive the data. The *outbuf* will contain only the received data
@@ -1015,8 +1021,9 @@ module RBS
1015
1021
  # -->
1016
1022
  # Returns the next line from the current file in ARGF.
1017
1023
  #
1018
- # By default lines are assumed to be separated by `$/`; to use a different
1019
- # character as a separator, supply it as a String for the *sep* argument.
1024
+ # By default lines are assumed to be separated by <code>$/</code>; to use a
1025
+ # different character as a separator, supply it as a String for the *sep*
1026
+ # argument.
1020
1027
  #
1021
1028
  # The optional *limit* argument specifies how many characters of each line to
1022
1029
  # return. By default all characters are returned.
@@ -1041,7 +1048,7 @@ module RBS
1041
1048
  # lines = ARGF.readlines
1042
1049
  # lines[0] #=> "This is line one\n"
1043
1050
  #
1044
- # See `IO.readlines` for a full description of all options.
1051
+ # See <code>IO.readlines</code> for a full description of all options.
1045
1052
  #
1046
1053
  %a{annotate:rdoc:copy:ARGF#readlines}
1047
1054
  def readlines: (?String sep, ?Integer limit, ?chomp: boolish) -> ::Array[String]
@@ -1161,7 +1168,7 @@ module RBS
1161
1168
  # lines = ARGF.readlines
1162
1169
  # lines[0] #=> "This is line one\n"
1163
1170
  #
1164
- # See `IO.readlines` for a full description of all options.
1171
+ # See <code>IO.readlines</code> for a full description of all options.
1165
1172
  #
1166
1173
  %a{annotate:rdoc:copy:ARGF#to_a}
1167
1174
  def to_a: (?String sep, ?Integer limit) -> ::Array[String]
@@ -34,7 +34,7 @@ module RBS
34
34
  # ENV[''] = '0'
35
35
  # # Raises Errno::EINVAL (Invalid argument - ruby_setenv())
36
36
  #
37
- # * May not contain character `"="`:
37
+ # * May not contain character <code>"="</code>:
38
38
  # ENV['='] = '0'
39
39
  # # Raises Errno::EINVAL (Invalid argument - ruby_setenv(=))
40
40
  #
@@ -47,7 +47,7 @@ module RBS
47
47
  # ENV[Object.new] = '0'
48
48
  # # Raises TypeError (no implicit conversion of Object into String)
49
49
  #
50
- # * May not contain the NUL character `"\0"`:
50
+ # * May not contain the NUL character <code>"\0"</code>:
51
51
  #
52
52
  # ENV['foo'] = "\0"
53
53
  # # Raises ArgumentError (bad environment variable value: contains null byte)
@@ -156,7 +156,7 @@ module RBS
156
156
  # * ::to_a: Returns the entries as an array of 2-element Arrays.
157
157
  # * ::to_h: Returns a hash of entries selected by the block.
158
158
  # * ::to_hash: Returns a hash of all entries.
159
- # * ::to_s: Returns the string `'ENV'`.
159
+ # * ::to_s: Returns the string <code>'ENV'</code>.
160
160
  # * ::values: Returns all values as an array.
161
161
  # * ::values_at: Returns an array of the values for the given name.
162
162
  #
@@ -1001,11 +1001,12 @@ module RBS
1001
1001
  # ENV.include?('baz') # => false
1002
1002
  #
1003
1003
  # Returns `false` if `name` is the empty String or is a String containing
1004
- # character `'='`:
1004
+ # character <code>'='</code>:
1005
1005
  # ENV.include?('') # => false
1006
1006
  # ENV.include?('=') # => false
1007
1007
  #
1008
- # Raises an exception if `name` is a String containing the NUL character `"\0"`:
1008
+ # Raises an exception if `name` is a String containing the NUL character
1009
+ # <code>"\0"</code>:
1009
1010
  # ENV.include?("\0") # Raises ArgumentError (bad environment variable name: contains null byte)
1010
1011
  #
1011
1012
  # Raises an exception if `name` has an encoding that is not ASCII-compatible:
@@ -1034,11 +1035,12 @@ module RBS
1034
1035
  # ENV.include?('baz') # => false
1035
1036
  #
1036
1037
  # Returns `false` if `name` is the empty String or is a String containing
1037
- # character `'='`:
1038
+ # character <code>'='</code>:
1038
1039
  # ENV.include?('') # => false
1039
1040
  # ENV.include?('=') # => false
1040
1041
  #
1041
- # Raises an exception if `name` is a String containing the NUL character `"\0"`:
1042
+ # Raises an exception if `name` is a String containing the NUL character
1043
+ # <code>"\0"</code>:
1042
1044
  # ENV.include?("\0") # Raises ArgumentError (bad environment variable name: contains null byte)
1043
1045
  #
1044
1046
  # Raises an exception if `name` has an encoding that is not ASCII-compatible:
@@ -1067,11 +1069,12 @@ module RBS
1067
1069
  # ENV.include?('baz') # => false
1068
1070
  #
1069
1071
  # Returns `false` if `name` is the empty String or is a String containing
1070
- # character `'='`:
1072
+ # character <code>'='</code>:
1071
1073
  # ENV.include?('') # => false
1072
1074
  # ENV.include?('=') # => false
1073
1075
  #
1074
- # Raises an exception if `name` is a String containing the NUL character `"\0"`:
1076
+ # Raises an exception if `name` is a String containing the NUL character
1077
+ # <code>"\0"</code>:
1075
1078
  # ENV.include?("\0") # Raises ArgumentError (bad environment variable name: contains null byte)
1076
1079
  #
1077
1080
  # Raises an exception if `name` has an encoding that is not ASCII-compatible:
@@ -1132,11 +1135,12 @@ module RBS
1132
1135
  # ENV.include?('baz') # => false
1133
1136
  #
1134
1137
  # Returns `false` if `name` is the empty String or is a String containing
1135
- # character `'='`:
1138
+ # character <code>'='</code>:
1136
1139
  # ENV.include?('') # => false
1137
1140
  # ENV.include?('=') # => false
1138
1141
  #
1139
- # Raises an exception if `name` is a String containing the NUL character `"\0"`:
1142
+ # Raises an exception if `name` is a String containing the NUL character
1143
+ # <code>"\0"</code>:
1140
1144
  # ENV.include?("\0") # Raises ArgumentError (bad environment variable name: contains null byte)
1141
1145
  #
1142
1146
  # Raises an exception if `name` has an encoding that is not ASCII-compatible:
@@ -1173,9 +1177,10 @@ module RBS
1173
1177
  # variable.
1174
1178
  #
1175
1179
  # Returns `nil` if `name` is the empty String or is a String containing
1176
- # character `'='`.
1180
+ # character <code>'='</code>.
1177
1181
  #
1178
- # Raises an exception if `name` is a String containing the NUL character `"\0"`:
1182
+ # Raises an exception if `name` is a String containing the NUL character
1183
+ # <code>"\0"</code>:
1179
1184
  # ENV.assoc("\0") # Raises ArgumentError (bad environment variable name: contains null byte)
1180
1185
  #
1181
1186
  # Raises an exception if `name` has an encoding that is not ASCII-compatible:
@@ -0,0 +1,123 @@
1
+ module RBS
2
+ module Unnamed
3
+ class TopLevelSelfClass
4
+ private
5
+
6
+ # <!--
7
+ # rdoc-file=eval.c
8
+ # - include(module, ...) -> self
9
+ # -->
10
+ # Invokes Module.append_features on each parameter in reverse order.
11
+ #
12
+ %a{annotate:rdoc:copy:Module#include}
13
+ def include: (Module, *Module arg0) -> self
14
+
15
+ # <!--
16
+ # rdoc-file=eval.c
17
+ # - using(module) -> self
18
+ # -->
19
+ # Import class refinements from *module* into the current class or module
20
+ # definition.
21
+ #
22
+ %a{annotate:rdoc:copy:Module#using}
23
+ def using: (Module arg0) -> self
24
+
25
+ # <!--
26
+ # rdoc-file=proc.c
27
+ # - define_method(symbol, method) -> symbol
28
+ # - define_method(symbol) { block } -> symbol
29
+ # -->
30
+ # Defines an instance method in the receiver. The *method* parameter can be a
31
+ # `Proc`, a `Method` or an `UnboundMethod` object. If a block is specified, it
32
+ # is used as the method body. If a block or the *method* parameter has
33
+ # parameters, they're used as method parameters. This block is evaluated using
34
+ # #instance_eval.
35
+ #
36
+ # class A
37
+ # def fred
38
+ # puts "In Fred"
39
+ # end
40
+ # def create_method(name, &block)
41
+ # self.class.define_method(name, &block)
42
+ # end
43
+ # define_method(:wilma) { puts "Charge it!" }
44
+ # define_method(:flint) {|name| puts "I'm #{name}!"}
45
+ # end
46
+ # class B < A
47
+ # define_method(:barney, instance_method(:fred))
48
+ # end
49
+ # a = B.new
50
+ # a.barney
51
+ # a.wilma
52
+ # a.flint('Dino')
53
+ # a.create_method(:betty) { p self }
54
+ # a.betty
55
+ #
56
+ # <em>produces:</em>
57
+ #
58
+ # In Fred
59
+ # Charge it!
60
+ # I'm Dino!
61
+ # #<B:0x401b39e8>
62
+ #
63
+ %a{annotate:rdoc:copy:Module#define_method}
64
+ def define_method: (interned symbol, ^(?) [self: top] -> untyped | Method | UnboundMethod method) -> Symbol
65
+ | (interned symbol) { (?) [self: top] -> untyped } -> Symbol
66
+
67
+ # <!--
68
+ # rdoc-file=vm_method.c
69
+ # - public -> nil
70
+ # - public(method_name) -> method_name
71
+ # - public(method_name, method_name, ...) -> array
72
+ # - public(array) -> array
73
+ # -->
74
+ # With no arguments, sets the default visibility for subsequently defined
75
+ # methods to public. With arguments, sets the named methods to have public
76
+ # visibility. String arguments are converted to symbols. An Array of Symbols
77
+ # and/or Strings is also accepted. If a single argument is passed, it is
78
+ # returned. If no argument is passed, nil is returned. If multiple arguments are
79
+ # passed, the arguments are returned as an array.
80
+ #
81
+ %a{annotate:rdoc:copy:Module#public}
82
+ def public: () -> nil
83
+ | (Symbol method_name) -> Symbol
84
+ | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
85
+ | (string method_name) -> string
86
+ | (interned, interned, *interned method_name) -> Array[interned]
87
+ | (Array[interned]) -> Array[interned]
88
+
89
+ # <!--
90
+ # rdoc-file=vm_method.c
91
+ # - private -> nil
92
+ # - private(method_name) -> method_name
93
+ # - private(method_name, method_name, ...) -> array
94
+ # - private(array) -> array
95
+ # -->
96
+ # With no arguments, sets the default visibility for subsequently defined
97
+ # methods to private. With arguments, sets the named methods to have private
98
+ # visibility. String arguments are converted to symbols. An Array of Symbols
99
+ # and/or Strings is also accepted. If a single argument is passed, it is
100
+ # returned. If no argument is passed, nil is returned. If multiple arguments are
101
+ # passed, the arguments are returned as an array.
102
+ #
103
+ # module Mod
104
+ # def a() end
105
+ # def b() end
106
+ # private
107
+ # def c() end
108
+ # private :a
109
+ # end
110
+ # Mod.private_instance_methods #=> [:a, :c]
111
+ #
112
+ # Note that to show a private method on RDoc, use <code>:doc:</code>.
113
+ #
114
+ %a{annotate:rdoc:copy:Module#private}
115
+ def private: () -> nil
116
+ | (Symbol method_name) -> Symbol
117
+ | (Symbol, Symbol, *Symbol method_name) -> Array[Symbol]
118
+ | (string method_name) -> string
119
+ | (interned, interned, *interned method_name) -> Array[interned]
120
+ | (Array[interned]) -> Array[interned]
121
+ end
122
+ end
123
+ end
@@ -38,7 +38,7 @@ module RBS
38
38
  # rand(1.5) # => 0
39
39
  #
40
40
  # When `range` is a Range, `rand` returns a random number where
41
- # `range.member?(number) == true`.
41
+ # <code>range.member?(number) == true</code>.
42
42
  #
43
43
  # prng.rand(5..9) # => one of [5, 6, 7, 8, 9]
44
44
  # prng.rand(5...9) # => one of [5, 6, 7, 8]
@@ -46,7 +46,8 @@ module RBS
46
46
  # prng.rand(5.0...9.0) # => between 5.0 and 9.0, excluding 9.0
47
47
  #
48
48
  # Both the beginning and ending values of the range must respond to subtract
49
- # (`-`) and add (`+`)methods, or rand will raise an ArgumentError.
49
+ # (<code>-</code>) and add (<code>+</code>)methods, or rand will raise an
50
+ # ArgumentError.
50
51
  #
51
52
  %a{annotate:rdoc:copy:Random#rand}
52
53
  def rand: (?0) -> Float
@@ -87,9 +88,10 @@ module RBS
87
88
  # <!-- rdoc-file=lib/random/formatter.rb -->
88
89
  # ## Random number formatter.
89
90
  #
90
- # Formats generated random numbers in many manners. When `'random/formatter'` is
91
- # required, several methods are added to empty core module `Random::Formatter`,
92
- # making them available as Random's instance and module methods.
91
+ # Formats generated random numbers in many manners. When
92
+ # <code>'random/formatter'</code> is required, several methods are added to
93
+ # empty core module <code>Random::Formatter</code>, making them available as
94
+ # Random's instance and module methods.
93
95
  #
94
96
  # Standard library SecureRandom is also extended with the module, and the
95
97
  # methods described below are available as a module methods in it.