rbs 3.0.0.dev.1 → 3.0.0.dev.3

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 (165) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -1
  3. data/.github/workflows/ruby.yml +4 -3
  4. data/CHANGELOG.md +28 -0
  5. data/Gemfile.lock +12 -12
  6. data/README.md +1 -0
  7. data/Rakefile +77 -3
  8. data/Steepfile +1 -1
  9. data/core/array.rbs +574 -424
  10. data/core/basic_object.rbs +11 -39
  11. data/core/binding.rbs +1 -1
  12. data/core/builtin.rbs +9 -1
  13. data/core/class.rbs +37 -0
  14. data/core/comparable.rbs +7 -18
  15. data/core/complex.rbs +2 -2
  16. data/core/data.rbs +419 -0
  17. data/core/dir.rbs +52 -104
  18. data/core/encoding.rbs +22 -181
  19. data/core/enumerable.rbs +212 -175
  20. data/core/enumerator/product.rbs +96 -0
  21. data/core/enumerator.rbs +57 -8
  22. data/core/errors.rbs +8 -2
  23. data/core/exception.rbs +41 -0
  24. data/core/fiber.rbs +95 -12
  25. data/core/file.rbs +840 -275
  26. data/core/file_test.rbs +34 -19
  27. data/core/float.rbs +40 -96
  28. data/core/gc.rbs +15 -3
  29. data/core/hash.rbs +114 -176
  30. data/core/integer.rbs +85 -145
  31. data/core/io/buffer.rbs +187 -60
  32. data/core/io/wait.rbs +28 -16
  33. data/core/io.rbs +1859 -1389
  34. data/core/kernel.rbs +525 -961
  35. data/core/match_data.rbs +306 -142
  36. data/core/math.rbs +506 -234
  37. data/core/method.rbs +0 -24
  38. data/core/module.rbs +111 -18
  39. data/core/nil_class.rbs +2 -0
  40. data/core/numeric.rbs +76 -144
  41. data/core/object.rbs +88 -212
  42. data/core/proc.rbs +17 -5
  43. data/core/process.rbs +22 -5
  44. data/core/ractor.rbs +1 -1
  45. data/core/random.rbs +20 -3
  46. data/core/range.rbs +91 -89
  47. data/core/rational.rbs +2 -3
  48. data/core/rbs/unnamed/argf.rbs +177 -120
  49. data/core/rbs/unnamed/env_class.rbs +89 -163
  50. data/core/rbs/unnamed/random.rbs +36 -12
  51. data/core/refinement.rbs +8 -0
  52. data/core/regexp.rbs +462 -272
  53. data/core/ruby_vm.rbs +210 -0
  54. data/{stdlib/set/0 → core}/set.rbs +43 -47
  55. data/core/string.rbs +1403 -1332
  56. data/core/string_io.rbs +191 -107
  57. data/core/struct.rbs +67 -63
  58. data/core/symbol.rbs +187 -201
  59. data/core/thread.rbs +40 -35
  60. data/core/time.rbs +902 -826
  61. data/core/trace_point.rbs +55 -6
  62. data/core/unbound_method.rbs +48 -24
  63. data/docs/collection.md +4 -0
  64. data/docs/syntax.md +55 -0
  65. data/ext/rbs_extension/constants.c +16 -2
  66. data/ext/rbs_extension/constants.h +8 -1
  67. data/ext/rbs_extension/extconf.rb +1 -1
  68. data/ext/rbs_extension/lexer.c +834 -777
  69. data/ext/rbs_extension/lexer.h +3 -1
  70. data/ext/rbs_extension/lexer.re +3 -1
  71. data/ext/rbs_extension/lexstate.c +4 -2
  72. data/ext/rbs_extension/parser.c +262 -43
  73. data/ext/rbs_extension/ruby_objs.c +56 -2
  74. data/ext/rbs_extension/ruby_objs.h +7 -1
  75. data/lib/rbs/annotate/rdoc_annotator.rb +1 -1
  76. data/lib/rbs/ast/declarations.rb +49 -2
  77. data/lib/rbs/ast/directives.rb +39 -0
  78. data/lib/rbs/cli.rb +38 -19
  79. data/lib/rbs/collection/cleaner.rb +8 -1
  80. data/lib/rbs/collection/config/lockfile.rb +3 -1
  81. data/lib/rbs/collection/config/lockfile_generator.rb +37 -30
  82. data/lib/rbs/collection/config.rb +3 -3
  83. data/lib/rbs/collection/sources/git.rb +10 -3
  84. data/lib/rbs/collection/sources/local.rb +79 -0
  85. data/lib/rbs/collection/sources.rb +8 -1
  86. data/lib/rbs/definition_builder/ancestor_builder.rb +24 -8
  87. data/lib/rbs/definition_builder.rb +8 -8
  88. data/lib/rbs/environment/use_map.rb +77 -0
  89. data/lib/rbs/environment.rb +358 -88
  90. data/lib/rbs/environment_loader.rb +12 -9
  91. data/lib/rbs/environment_walker.rb +1 -1
  92. data/lib/rbs/errors.rb +52 -37
  93. data/lib/rbs/locator.rb +27 -8
  94. data/lib/rbs/parser_aux.rb +8 -6
  95. data/lib/rbs/resolver/constant_resolver.rb +23 -7
  96. data/lib/rbs/resolver/type_name_resolver.rb +2 -1
  97. data/lib/rbs/sorter.rb +5 -5
  98. data/lib/rbs/test/setup.rb +1 -1
  99. data/lib/rbs/type_alias_dependency.rb +1 -1
  100. data/lib/rbs/type_alias_regularity.rb +3 -3
  101. data/lib/rbs/validator.rb +23 -2
  102. data/lib/rbs/variance_calculator.rb +2 -2
  103. data/lib/rbs/version.rb +1 -1
  104. data/lib/rbs/writer.rb +28 -2
  105. data/lib/rbs.rb +2 -2
  106. data/lib/rdoc_plugin/parser.rb +2 -2
  107. data/rbs.gemspec +1 -1
  108. data/sig/ancestor_graph.rbs +22 -2
  109. data/sig/collection/config/lockfile_generator.rbs +8 -10
  110. data/sig/collection/config.rbs +1 -1
  111. data/sig/collection/sources.rbs +44 -9
  112. data/sig/constant.rbs +1 -1
  113. data/sig/declarations.rbs +36 -3
  114. data/sig/definition.rbs +1 -1
  115. data/sig/definition_builder.rbs +0 -1
  116. data/sig/directives.rbs +61 -0
  117. data/sig/environment.rbs +150 -29
  118. data/sig/environment_loader.rbs +1 -1
  119. data/sig/errors.rbs +22 -1
  120. data/sig/locator.rbs +14 -2
  121. data/sig/parser.rbs +8 -15
  122. data/sig/resolver/constant_resolver.rbs +1 -2
  123. data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
  124. data/sig/shims/bundler.rbs +18 -0
  125. data/sig/shims/rubygems.rbs +6 -0
  126. data/sig/use_map.rbs +35 -0
  127. data/sig/validator.rbs +12 -5
  128. data/sig/writer.rbs +4 -2
  129. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
  130. data/stdlib/cgi/0/core.rbs +16 -0
  131. data/stdlib/coverage/0/coverage.rbs +50 -8
  132. data/stdlib/csv/0/csv.rbs +1 -1
  133. data/stdlib/date/0/date.rbs +856 -726
  134. data/stdlib/date/0/date_time.rbs +83 -210
  135. data/stdlib/erb/0/erb.rbs +13 -36
  136. data/stdlib/etc/0/etc.rbs +127 -20
  137. data/stdlib/fileutils/0/fileutils.rbs +1290 -381
  138. data/stdlib/logger/0/logger.rbs +466 -316
  139. data/stdlib/net-http/0/net-http.rbs +2211 -534
  140. data/stdlib/nkf/0/nkf.rbs +5 -5
  141. data/stdlib/objspace/0/objspace.rbs +31 -14
  142. data/stdlib/openssl/0/openssl.rbs +11 -7
  143. data/stdlib/optparse/0/optparse.rbs +20 -17
  144. data/stdlib/pathname/0/pathname.rbs +21 -4
  145. data/stdlib/pstore/0/pstore.rbs +378 -154
  146. data/stdlib/pty/0/pty.rbs +24 -8
  147. data/stdlib/ripper/0/ripper.rbs +1650 -0
  148. data/stdlib/socket/0/addrinfo.rbs +9 -15
  149. data/stdlib/socket/0/socket.rbs +36 -3
  150. data/stdlib/strscan/0/string_scanner.rbs +7 -5
  151. data/stdlib/tempfile/0/tempfile.rbs +104 -44
  152. data/stdlib/time/0/time.rbs +2 -2
  153. data/stdlib/uri/0/file.rbs +5 -0
  154. data/stdlib/uri/0/generic.rbs +2 -2
  155. data/stdlib/yaml/0/yaml.rbs +2 -2
  156. data/stdlib/zlib/0/zlib.rbs +1 -1
  157. metadata +13 -13
  158. data/core/deprecated.rbs +0 -9
  159. data/lib/rbs/constant_table.rb +0 -167
  160. data/lib/rbs/type_name_resolver.rb +0 -67
  161. data/sig/constant_table.rbs +0 -30
  162. data/sig/shims/ripper.rbs +0 -8
  163. data/sig/type_name_resolver.rbs +0 -26
  164. data/steep/Gemfile +0 -3
  165. data/steep/Gemfile.lock +0 -61
data/sig/parser.rbs CHANGED
@@ -6,15 +6,13 @@ module RBS
6
6
  # If no token is left in the input, it returns `nil`.
7
7
  #
8
8
  # ```ruby
9
+ # RBS::Parser.parse_method_type("() -> void") # => `() -> void`
9
10
  # RBS::Parser.parse_method_type("() -> void", range: 0...) # => `() -> void`
10
11
  # RBS::Parser.parse_method_type("() -> void () -> String", range: 11...) # => `() -> String`
11
12
  # RBS::Parser.parse_method_type("() -> void () -> String", range: 23...) # => nil
12
13
  # ```
13
14
  #
14
- # `line` and `column` is deprecated and are ignored.
15
- #
16
- def self.parse_method_type: (Buffer | String, range: Range[Integer?], ?variables: Array[Symbol]) -> MethodType?
17
- | (Buffer | String, ?line: top, ?column: top, ?variables: Array[Symbol]) -> MethodType
15
+ def self.parse_method_type: (Buffer | String, ?range: Range[Integer?], ?variables: Array[Symbol]) -> MethodType?
18
16
 
19
17
  # Parse a type and return it
20
18
  #
@@ -22,22 +20,17 @@ module RBS
22
20
  # If no token is left in the input, it returns `nil`.
23
21
  #
24
22
  # ```ruby
23
+ # RBS::Parser.parse_type("String") # => `String`
25
24
  # RBS::Parser.parse_type("String", range: 0...) # => `String`
26
25
  # RBS::Parser.parse_type("String Integer", pos: 7...) # => `Integer`
27
26
  # RBS::Parser.parse_type("String Integer", pos: 14...) # => nil
28
27
  # ```
29
28
  #
30
- # `line` and `column` is deprecated and are ignored.
31
- #
32
- def self.parse_type: (Buffer | String, range: Range[Integer?], ?variables: Array[Symbol]) -> Types::t?
33
- | (Buffer | String, ?line: top, ?column: top, ?variables: Array[Symbol]) -> Types::t
29
+ def self.parse_type: (Buffer | String, ?range: Range[Integer?], ?variables: Array[Symbol]) -> Types::t?
34
30
 
35
31
  # Parse whole RBS file and return an array of declarations
36
32
  #
37
- # `line` and `column` is deprecated and are ignored.
38
- #
39
- def self.parse_signature: (Buffer | String) -> Array[AST::Declarations::t]
40
- | (Buffer | String, ?line: top, ?column: top) -> Array[AST::Declarations::t]
33
+ def self.parse_signature: (Buffer | String) -> [Buffer, Array[AST::Directives::t], Array[AST::Declarations::t]]
41
34
 
42
35
  KEYWORDS: Hash[String, bot]
43
36
 
@@ -45,11 +38,11 @@ module RBS
45
38
 
46
39
  def self.buffer: (String | Buffer source) -> Buffer
47
40
 
48
- def self._parse_type: (Buffer, Integer start_pos, Integer end_pos, Array[Symbol] variables, boolish eof) -> Types::t?
41
+ def self._parse_type: (Buffer, Integer start_pos, Integer end_pos, Array[Symbol] variables) -> Types::t?
49
42
 
50
- def self._parse_method_type: (Buffer, Integer start_pos, Integer end_pos, Array[Symbol] variables, boolish eof) -> MethodType?
43
+ def self._parse_method_type: (Buffer, Integer start_pos, Integer end_pos, Array[Symbol] variables) -> MethodType?
51
44
 
52
- def self._parse_signature: (Buffer, Integer end_pos) -> Array[AST::Declarations::t]
45
+ def self._parse_signature: (Buffer, Integer end_pos) -> [Array[AST::Directives::t], Array[AST::Declarations::t]]
53
46
 
54
47
  class LocatedValue
55
48
  end
@@ -37,7 +37,7 @@ module RBS
37
37
 
38
38
  def constant_of_module: (TypeName name, Environment::ClassEntry | Environment::ModuleEntry) -> Constant
39
39
 
40
- def constant_of_constant: (TypeName name, Environment::SingleEntry[TypeName, AST::Declarations::Constant]) -> Constant
40
+ def constant_of_constant: (TypeName name, Environment::ConstantEntry) -> Constant
41
41
  end
42
42
 
43
43
  attr_reader builder: DefinitionBuilder
@@ -65,7 +65,6 @@ module RBS
65
65
  # ^ <- constant_name
66
66
  # ```
67
67
  #
68
- # Find the
69
68
  def resolve_child: (TypeName module_name, Symbol constant_name) -> Constant?
70
69
 
71
70
  # Returns the table of all constants accessible with `::` (colon2) operator.
@@ -1,13 +1,31 @@
1
1
  module Bundler
2
2
  class LockfileParser
3
3
  def initialize: (String) -> void
4
+
4
5
  def specs: () -> Array[LazySpecification]
5
6
  end
6
7
 
7
8
  class LazySpecification
8
9
  def name: () -> String
10
+
9
11
  def version: () -> String
12
+
13
+ def dependencies: () -> Array[Gem::Dependency]
14
+ end
15
+
16
+ class Dependency < Gem::Dependency
17
+ attr_reader autorequire: Array[String]?
18
+ end
19
+
20
+ class Definition
21
+ def lockfile: () -> Pathname
22
+
23
+ def locked_gems: () -> LockfileParser
24
+
25
+ def dependencies: () -> Array[Dependency]
10
26
  end
11
27
 
12
28
  def self.default_lockfile: () -> Pathname
29
+
30
+ def self.definition: () -> Definition
13
31
  end
@@ -5,5 +5,11 @@ module Gem
5
5
  attr_reader gem_dir (): String
6
6
 
7
7
  def self.find_by_name: (String name, *String requirements) -> instance
8
+
9
+ def dependencies: () -> Array[Dependency]
10
+ end
11
+
12
+ class Dependency
13
+ def name: () -> String
8
14
  end
9
15
  end
data/sig/use_map.rbs ADDED
@@ -0,0 +1,35 @@
1
+ module RBS
2
+ class Environment
3
+ # ```rb
4
+ # map = UseMap.build(environment)
5
+ #
6
+ # map.resolve?(TypeName("TN")) # => nil or resolved type name
7
+ # ```
8
+ #
9
+ class UseMap
10
+ class Table
11
+ attr_reader known_types: Set[TypeName]
12
+
13
+ attr_reader children: Hash[Namespace, Set[TypeName]]
14
+
15
+ def initialize: () -> void
16
+
17
+ def compute_children: () -> self
18
+ end
19
+
20
+ attr_reader use_dirs: Array[AST::Directives::Use]
21
+
22
+ @map: Hash[Symbol, TypeName]
23
+
24
+ @table: Table
25
+
26
+ def initialize: (table: Table) -> void
27
+
28
+ def resolve?: (TypeName) -> TypeName?
29
+
30
+ def resolve: (TypeName) -> TypeName
31
+
32
+ def build_map: (AST::Directives::Use::clause) -> self
33
+ end
34
+ end
35
+ end
data/sig/validator.rbs CHANGED
@@ -2,7 +2,7 @@ module RBS
2
2
  class Validator
3
3
  attr_reader env: Environment
4
4
 
5
- attr_reader resolver: TypeNameResolver
5
+ attr_reader resolver: Resolver::TypeNameResolver
6
6
 
7
7
  attr_reader definition_builder: DefinitionBuilder
8
8
 
@@ -10,11 +10,11 @@ module RBS
10
10
 
11
11
  attr_reader type_alias_regularity: TypeAliasRegularity
12
12
 
13
- def initialize: (env: Environment, resolver: TypeNameResolver) -> void
13
+ def initialize: (env: Environment, resolver: Resolver::TypeNameResolver) -> void
14
14
 
15
15
  # Validates the presence of type names and type application arity match.
16
16
  #
17
- def validate_type: (Types::t, context: TypeNameResolver::context) -> void
17
+ def validate_type: (Types::t, context: Resolver::context) -> void
18
18
 
19
19
  # Validates type alias definition:
20
20
  #
@@ -25,7 +25,7 @@ module RBS
25
25
  #
26
26
  # It yields the rhs type if block is given, so that you can validate the rhs type.
27
27
  #
28
- def validate_type_alias: (entry: Environment::SingleEntry[TypeName, AST::Declarations::Alias]) ?{ (Types::t rhs_type) -> void } -> void
28
+ def validate_type_alias: (entry: Environment::TypeAliasEntry) ?{ (Types::t rhs_type) -> void } -> void
29
29
 
30
30
  # Validates the type parameters in generic methods.
31
31
  #
@@ -42,11 +42,18 @@ module RBS
42
42
  #
43
43
  def validate_type_params: (Array[AST::TypeParam] params, type_name: TypeName, ?method_name: Symbol?, location: Location[untyped, untyped]?) -> void
44
44
 
45
+ # Validates class alias declaration
46
+ #
47
+ # - The right hand side can be normalized
48
+ # - No mixing alias declaration between class and modules
49
+ #
50
+ def validate_class_alias: (entry: Environment::ClassAliasEntry | Environment::ModuleAliasEntry) -> void
51
+
45
52
  private
46
53
 
47
54
  # Resolves relative type names to absolute type names in given context.
48
55
  # Yields the type when the type name resolution using `#resolver` fails.
49
56
  #
50
- def absolute_type: (Types::t, context: TypeNameResolver::context) { (Types::t) -> TypeName } -> Types::t
57
+ def absolute_type: (Types::t, context: Resolver::context) { (Types::t) -> TypeName } -> Types::t
51
58
  end
52
59
  end
data/sig/writer.rbs CHANGED
@@ -21,7 +21,7 @@ module RBS
21
21
  # Output the array of declarations.
22
22
  # It automatically inserts empty lines between the declarations.
23
23
  #
24
- def write: (Array[AST::Declarations::t]) -> void
24
+ def write: (Array[AST::Declarations::t | AST::Directives::t]) -> void
25
25
 
26
26
  def preserve?: () -> bool
27
27
 
@@ -96,6 +96,8 @@ module RBS
96
96
 
97
97
  def format_annotation: (AST::Annotation) -> String
98
98
 
99
+ def write_directive: (AST::Directives::t) -> void
100
+
99
101
  def write_annotation: (Array[AST::Annotation]) -> void
100
102
 
101
103
  def write_comment: (AST::Comment?) -> void
@@ -108,7 +110,7 @@ module RBS
108
110
 
109
111
  def name_and_args: (TypeName, Array[Types::t]) -> String?
110
112
 
111
- def write_alias: (AST::Declarations::Alias) -> void
113
+ def write_alias: (AST::Declarations::TypeAlias) -> void
112
114
 
113
115
  def method_name: (Symbol) -> String
114
116
 
@@ -145,12 +145,8 @@ class BigDecimal < Numeric
145
145
 
146
146
  # <!--
147
147
  # rdoc-file=ext/bigdecimal/bigdecimal.c
148
- # - BigDecimal.double_fig -> integer
148
+ # - double_fig()
149
149
  # -->
150
- # Returns the number of digits a Float object is allowed to have; the result is
151
- # system-dependent:
152
- #
153
- # BigDecimal.double_fig # => 16
154
150
  #
155
151
  def self.double_fig: () -> Integer
156
152
 
@@ -1007,7 +1003,9 @@ class BigDecimal < Numeric
1007
1003
  # -->
1008
1004
  # Returns the sign of the value.
1009
1005
  #
1010
- # Returns a positive value if > 0, a negative value if < 0, and a zero if == 0.
1006
+ # Returns a positive value if > 0, a negative value if < 0. It behaves the same
1007
+ # with zeros - it returns a positive value for a positive zero (BigDecimal('0'))
1008
+ # and a negative value for a negative zero (BigDecimal('-0')).
1011
1009
  #
1012
1010
  # The specific value returned indicates the type and sign of the BigDecimal, as
1013
1011
  # follows:
@@ -1348,12 +1346,15 @@ module Kernel
1348
1346
  # - BigDecimal(value, exception: true) -> bigdecimal
1349
1347
  # - BigDecimal(value, ndigits, exception: true) -> bigdecimal
1350
1348
  # -->
1351
- # Returns the \BigDecimal converted from +value+
1352
- # with a precision of +ndigits+ decimal digits.
1349
+ # Returns the BigDecimal converted from `value` with a precision of `ndigits`
1350
+ # decimal digits.
1351
+ #
1352
+ # When `ndigits` is less than the number of significant digits in the value, the
1353
+ # result is rounded to that number of digits, according to the current rounding
1354
+ # mode; see BigDecimal.mode.
1353
1355
  #
1354
- # When +ndigits+ is less than the number of significant digits
1355
- # in the value, the result is rounded to that number of digits,
1356
- # according to the current rounding mode; see BigDecimal.mode.
1356
+ # When `ndigits` is 0, the number of digits to correctly represent a float
1357
+ # number is determined automatically.
1357
1358
  #
1358
1359
  # Returns `value` converted to a BigDecimal, depending on the type of `value`:
1359
1360
  #
@@ -1486,13 +1487,15 @@ class Float
1486
1487
  # - float.to_d(precision) -> bigdecimal
1487
1488
  # -->
1488
1489
  # Returns the value of `float` as a BigDecimal. The `precision` parameter is
1489
- # used to determine the number of significant digits for the result (the default
1490
- # is Float::DIG).
1490
+ # used to determine the number of significant digits for the result. When
1491
+ # `precision` is set to `0`, the number of digits to represent the float being
1492
+ # converted is determined automatically. The default `precision` is `0`.
1491
1493
  #
1492
1494
  # require 'bigdecimal'
1493
1495
  # require 'bigdecimal/util'
1494
1496
  #
1495
1497
  # 0.5.to_d # => 0.5e0
1498
+ # 1.234.to_d # => 0.1234e1
1496
1499
  # 1.234.to_d(2) # => 0.12e1
1497
1500
  #
1498
1501
  # See also BigDecimal::new.
@@ -882,6 +882,14 @@ class CGI
882
882
  #
883
883
  def escapeHTML: (string str) -> String
884
884
 
885
+ # <!--
886
+ # rdoc-file=ext/cgi/escape/escape.c
887
+ # - CGI.escapeURIComponent(string) -> string
888
+ # -->
889
+ # Returns URL-escaped string following RFC 3986.
890
+ #
891
+ def escapeURIComponent: (string) -> String
892
+
885
893
  # <!--
886
894
  # rdoc-file=ext/cgi/escape/escape.c
887
895
  # - CGI.unescape(string, encoding=@@accept_charset) -> string
@@ -897,6 +905,14 @@ class CGI
897
905
  # Returns HTML-unescaped string.
898
906
  #
899
907
  def unescapeHTML: (string str) -> String
908
+
909
+ # <!--
910
+ # rdoc-file=ext/cgi/escape/escape.c
911
+ # - CGI.unescapeURIComponent(string, encoding=@@accept_charset) -> string
912
+ # -->
913
+ # Returns URL-unescaped string following RFC 3986.
914
+ #
915
+ def unescapeURIComponent: (string) -> String
900
916
  end
901
917
 
902
918
  # <!-- rdoc-file=lib/cgi/core.rb -->
@@ -3,7 +3,7 @@
3
3
  # experimental, so these APIs may be changed in future.
4
4
  #
5
5
  # Caveat: Currently, only process-global coverage measurement is supported. You
6
- # cannot measure per-thread covearge.
6
+ # cannot measure per-thread coverage.
7
7
  #
8
8
  # # Usage
9
9
  #
@@ -153,7 +153,7 @@ module Coverage
153
153
  # - line_stub(file)
154
154
  # -->
155
155
  #
156
- def self.line_stub: () -> Array[Integer?]
156
+ def self.line_stub: (String) -> Array[Integer?]
157
157
 
158
158
  # <!--
159
159
  # rdoc-file=ext/coverage/coverage.c
@@ -190,15 +190,41 @@ module Coverage
190
190
 
191
191
  # <!--
192
192
  # rdoc-file=ext/coverage/coverage.c
193
- # - Coverage.start => nil
194
- # - Coverage.start(:all) => nil
195
- # - Coverage.start(lines: bool, branches: bool, methods: bool) => nil
196
- # - Coverage.start(oneshot_lines: true) => nil
193
+ # - Coverage.setup => nil
194
+ # - Coverage.setup(:all) => nil
195
+ # - Coverage.setup(lines: bool, branches: bool, methods: bool, eval: bool) => nil
196
+ # - Coverage.setup(oneshot_lines: true) => nil
197
+ # -->
198
+ # Set up the coverage measurement.
199
+ #
200
+ # Note that this method does not start the measurement itself. Use
201
+ # Coverage.resume to start the measurement.
202
+ #
203
+ # You may want to use Coverage.start to setup and then start the measurement.
204
+ #
205
+ def self.setup: (?lines: bool, ?branches: bool, ?methods: bool, ?eval: bool) -> nil
206
+ | (oneshot_lines: bool, ?branches: bool, ?methods: bool, ?eval: bool) -> nil
207
+ | (:all) -> nil
208
+
209
+ # <!--
210
+ # rdoc-file=ext/coverage/coverage.c
211
+ # - Coverage.start => nil
212
+ # - Coverage.start(:all) => nil
213
+ # - Coverage.start(lines: bool, branches: bool, methods: bool, eval: bool) => nil
214
+ # - Coverage.start(oneshot_lines: true) => nil
197
215
  # -->
198
216
  # Enables the coverage measurement. See the documentation of Coverage class in
199
217
  # detail. This is equivalent to Coverage.setup and Coverage.resume.
200
218
  #
201
- def self.start: (?lines: boolish, ?branches: boolish, ?methods: boolish, ?oneshot_lines: boolish) -> nil
219
+ alias self.start self.setup
220
+
221
+ # <!--
222
+ # rdoc-file=ext/coverage/coverage.c
223
+ # - Coverage.state => :idle, :suspended, :running
224
+ # -->
225
+ # Returns the state of the coverage measurement.
226
+ #
227
+ def self.state: () -> (:idle | :suspended | :running)
202
228
 
203
229
  # <!--
204
230
  # rdoc-file=ext/coverage/coverage.c
@@ -207,12 +233,28 @@ module Coverage
207
233
  # Start/resume the coverage measurement.
208
234
  #
209
235
  # Caveat: Currently, only process-global coverage measurement is supported. You
210
- # cannot measure per-thread covearge. If your process has multiple thread, using
236
+ # cannot measure per-thread coverage. If your process has multiple thread, using
211
237
  # Coverage.resume/suspend to capture code coverage executed from only a limited
212
238
  # code block, may yield misleading results.
213
239
  #
214
240
  def self.resume: () -> nil
215
241
 
242
+ # <!--
243
+ # rdoc-file=ext/coverage/coverage.c
244
+ # - Coverage.supported?(mode) -> true or false
245
+ # -->
246
+ # Returns true if coverage measurement is supported for the given mode.
247
+ #
248
+ # The mode should be one of the following symbols: `:lines`, `:branches`,
249
+ # `:methods`, `:eval`.
250
+ #
251
+ # Example:
252
+ #
253
+ # Coverage.supported?(:lines) #=> true
254
+ # Coverage.supported?(:all) #=> false
255
+ #
256
+ def self.supported?: (Symbol) -> bool
257
+
216
258
  # <!--
217
259
  # rdoc-file=ext/coverage/coverage.c
218
260
  # - Coverage.suspend => nil
data/stdlib/csv/0/csv.rbs CHANGED
@@ -2488,7 +2488,7 @@ class CSV::Row < Object
2488
2488
  # `index_or_header` and `specifiers`.
2489
2489
  #
2490
2490
  # The nested objects may be instances of various classes. See [Dig
2491
- # Methods](https://docs.ruby-lang.org/en/master/dig_methods_rdoc.html).
2491
+ # Methods](rdoc-ref:dig_methods.rdoc).
2492
2492
  #
2493
2493
  # Examples:
2494
2494
  # source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n"