rbs 3.0.0.dev.2 → 3.0.0.dev.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -1
  3. data/.github/workflows/ruby.yml +4 -0
  4. data/Gemfile.lock +11 -11
  5. data/Rakefile +2 -2
  6. data/Steepfile +1 -1
  7. data/core/array.rbs +573 -423
  8. data/core/basic_object.rbs +11 -39
  9. data/core/binding.rbs +1 -1
  10. data/core/builtin.rbs +8 -0
  11. data/core/class.rbs +37 -0
  12. data/core/comparable.rbs +7 -18
  13. data/core/complex.rbs +2 -2
  14. data/core/data.rbs +419 -0
  15. data/core/dir.rbs +52 -104
  16. data/core/encoding.rbs +22 -181
  17. data/core/enumerable.rbs +212 -175
  18. data/core/enumerator/product.rbs +96 -0
  19. data/core/enumerator.rbs +57 -8
  20. data/core/errors.rbs +8 -2
  21. data/core/exception.rbs +41 -0
  22. data/core/fiber.rbs +95 -12
  23. data/core/file.rbs +840 -275
  24. data/core/file_test.rbs +34 -19
  25. data/core/float.rbs +40 -96
  26. data/core/gc.rbs +15 -3
  27. data/core/hash.rbs +113 -175
  28. data/core/integer.rbs +85 -145
  29. data/core/io/buffer.rbs +187 -60
  30. data/core/io/wait.rbs +28 -16
  31. data/core/io.rbs +1859 -1389
  32. data/core/kernel.rbs +525 -961
  33. data/core/match_data.rbs +306 -142
  34. data/core/math.rbs +506 -234
  35. data/core/method.rbs +0 -24
  36. data/core/module.rbs +110 -17
  37. data/core/nil_class.rbs +2 -0
  38. data/core/numeric.rbs +76 -144
  39. data/core/object.rbs +88 -212
  40. data/core/proc.rbs +17 -5
  41. data/core/process.rbs +22 -5
  42. data/core/ractor.rbs +1 -1
  43. data/core/random.rbs +20 -3
  44. data/core/range.rbs +91 -89
  45. data/core/rational.rbs +2 -3
  46. data/core/rbs/unnamed/argf.rbs +177 -120
  47. data/core/rbs/unnamed/env_class.rbs +89 -163
  48. data/core/rbs/unnamed/random.rbs +36 -12
  49. data/core/refinement.rbs +8 -0
  50. data/core/regexp.rbs +462 -272
  51. data/core/ruby_vm.rbs +210 -0
  52. data/{stdlib/set/0 → core}/set.rbs +43 -47
  53. data/core/string.rbs +1403 -1332
  54. data/core/string_io.rbs +191 -107
  55. data/core/struct.rbs +67 -63
  56. data/core/symbol.rbs +187 -201
  57. data/core/thread.rbs +40 -35
  58. data/core/time.rbs +902 -826
  59. data/core/trace_point.rbs +55 -6
  60. data/core/unbound_method.rbs +48 -24
  61. data/docs/collection.md +4 -0
  62. data/docs/syntax.md +55 -0
  63. data/ext/rbs_extension/parser.c +5 -6
  64. data/lib/rbs/cli.rb +6 -1
  65. data/lib/rbs/collection/cleaner.rb +8 -1
  66. data/lib/rbs/collection/config/lockfile.rb +3 -1
  67. data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
  68. data/lib/rbs/collection/config.rb +1 -1
  69. data/lib/rbs/collection/sources/git.rb +9 -2
  70. data/lib/rbs/collection/sources/local.rb +79 -0
  71. data/lib/rbs/collection/sources.rb +8 -1
  72. data/lib/rbs/environment.rb +6 -5
  73. data/lib/rbs/environment_loader.rb +3 -2
  74. data/lib/rbs/errors.rb +18 -0
  75. data/lib/rbs/locator.rb +26 -7
  76. data/lib/rbs/sorter.rb +2 -2
  77. data/lib/rbs/version.rb +1 -1
  78. data/sig/collection/sources.rbs +32 -3
  79. data/sig/environment.rbs +2 -3
  80. data/sig/locator.rbs +14 -2
  81. data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
  82. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
  83. data/stdlib/cgi/0/core.rbs +16 -0
  84. data/stdlib/coverage/0/coverage.rbs +50 -8
  85. data/stdlib/csv/0/csv.rbs +1 -1
  86. data/stdlib/date/0/date.rbs +856 -726
  87. data/stdlib/date/0/date_time.rbs +83 -210
  88. data/stdlib/erb/0/erb.rbs +13 -36
  89. data/stdlib/etc/0/etc.rbs +127 -20
  90. data/stdlib/fileutils/0/fileutils.rbs +1290 -381
  91. data/stdlib/logger/0/logger.rbs +466 -316
  92. data/stdlib/net-http/0/net-http.rbs +2211 -534
  93. data/stdlib/nkf/0/nkf.rbs +5 -5
  94. data/stdlib/objspace/0/objspace.rbs +31 -14
  95. data/stdlib/openssl/0/openssl.rbs +11 -7
  96. data/stdlib/optparse/0/optparse.rbs +20 -17
  97. data/stdlib/pathname/0/pathname.rbs +21 -4
  98. data/stdlib/pstore/0/pstore.rbs +378 -154
  99. data/stdlib/pty/0/pty.rbs +24 -8
  100. data/stdlib/ripper/0/ripper.rbs +1650 -0
  101. data/stdlib/socket/0/addrinfo.rbs +9 -15
  102. data/stdlib/socket/0/socket.rbs +36 -3
  103. data/stdlib/strscan/0/string_scanner.rbs +7 -5
  104. data/stdlib/tempfile/0/tempfile.rbs +104 -44
  105. data/stdlib/time/0/time.rbs +2 -2
  106. data/stdlib/uri/0/file.rbs +5 -0
  107. data/stdlib/uri/0/generic.rbs +2 -2
  108. data/stdlib/yaml/0/yaml.rbs +2 -2
  109. data/stdlib/zlib/0/zlib.rbs +1 -1
  110. metadata +8 -6
  111. data/core/deprecated.rbs +0 -9
  112. data/sig/shims/ripper.rbs +0 -8
data/core/object.rbs CHANGED
@@ -18,162 +18,92 @@
18
18
  #
19
19
  # First, what's elsewhere. Class Object:
20
20
  #
21
- # * Inherits from [class
22
- # BasicObject](BasicObject.html#class-BasicObject-label-What-27s+Here).
23
- # * Includes [module Kernel](Kernel.html#module-Kernel-label-What-27s+Here).
21
+ # * Inherits from [class BasicObject](rdoc-ref:BasicObject@What-27s+Here).
22
+ # * Includes [module Kernel](rdoc-ref:Kernel@What-27s+Here).
24
23
  #
25
24
  #
26
25
  # Here, class Object provides methods for:
27
26
  #
28
- # * [Querying](#class-Object-label-Querying)
29
- # * [Instance Variables](#class-Object-label-Instance+Variables)
30
- # * [Other](#class-Object-label-Other)
27
+ # * [Querying](rdoc-ref:Object@Querying)
28
+ # * [Instance Variables](rdoc-ref:Object@Instance+Variables)
29
+ # * [Other](rdoc-ref:Object@Other)
31
30
  #
32
31
  #
33
32
  # ### Querying
34
33
  #
35
- # [!~](#method-i-21~)
36
- # : Returns `true` if `self` does not match the given object, otherwise
37
- # `false`.
38
- #
39
- # [<=>](#method-i-3C-3D-3E)
40
- # : Returns 0 if `self` and the given object `object` are the same object,
41
- # or if `self == object`; otherwise returns `nil`.
42
- #
43
- # #===
44
- # : Implements case equality, effectively the same as calling #==.
45
- #
46
- # #eql?
47
- # : Implements hash equality, effectively the same as calling #==.
48
- #
49
- # #kind_of? (aliased as #is_a?)
50
- # : Returns whether given argument is an ancestor of the singleton class
51
- # of `self`.
52
- #
53
- # #instance_of?
54
- # : Returns whether `self` is an instance of the given class.
55
- #
56
- # #instance_variable_defined?
57
- # : Returns whether the given instance variable is defined in `self`.
58
- #
59
- # #method
60
- # : Returns the Method object for the given method in `self`.
61
- #
62
- # #methods
63
- # : Returns an array of symbol names of public and protected methods in
64
- # `self`.
65
- #
66
- # #nil?
67
- # : Returns `false`. (Only `nil` responds `true` to method `nil?`.)
68
- #
69
- # #object_id
70
- # : Returns an integer corresponding to `self` that is unique for the
71
- # current process
72
- #
73
- # #private_methods
74
- # : Returns an array of the symbol names of the private methods in `self`.
75
- #
76
- # #protected_methods
77
- # : Returns an array of the symbol names of the protected methods in
78
- # `self`.
79
- #
80
- # #public_method
81
- # : Returns the Method object for the given public method in `self`.
82
- #
83
- # #public_methods
84
- # : Returns an array of the symbol names of the public methods in `self`.
85
- #
86
- # #respond_to?
87
- # : Returns whether `self` responds to the given method.
88
- #
89
- # #singleton_class
90
- # : Returns the singleton class of `self`.
91
- #
92
- # #singleton_method
93
- # : Returns the Method object for the given singleton method in `self`.
94
- #
95
- # #singleton_methods
96
- # : Returns an array of the symbol names of the singleton methods in
97
- # `self`.
98
- #
99
- #
100
- # #define_singleton_method
101
- # : Defines a singleton method in `self` for the given symbol method-name
102
- # and block or proc.
103
- #
104
- # #extend
105
- # : Includes the given modules in the singleton class of `self`.
106
- #
107
- # #public_send
108
- # : Calls the given public method in `self` with the given argument.
109
- #
110
- # #send
111
- # : Calls the given method in `self` with the given argument.
34
+ # * #!~: Returns `true` if `self` does not match the given object, otherwise
35
+ # `false`.
36
+ # * #<=>: Returns 0 if `self` and the given object `object` are the same
37
+ # object, or if `self == object`; otherwise returns `nil`.
38
+ # * #===: Implements case equality, effectively the same as calling #==.
39
+ # * #eql?: Implements hash equality, effectively the same as calling #==.
40
+ # * #kind_of? (aliased as #is_a?): Returns whether given argument is an
41
+ # ancestor of the singleton class of `self`.
42
+ # * #instance_of?: Returns whether `self` is an instance of the given class.
43
+ # * #instance_variable_defined?: Returns whether the given instance variable
44
+ # is defined in `self`.
45
+ # * #method: Returns the Method object for the given method in `self`.
46
+ # * #methods: Returns an array of symbol names of public and protected methods
47
+ # in `self`.
48
+ # * #nil?: Returns `false`. (Only `nil` responds `true` to method `nil?`.)
49
+ # * #object_id: Returns an integer corresponding to `self` that is unique for
50
+ # the current process
51
+ # * #private_methods: Returns an array of the symbol names of the private
52
+ # methods in `self`.
53
+ # * #protected_methods: Returns an array of the symbol names of the protected
54
+ # methods in `self`.
55
+ # * #public_method: Returns the Method object for the given public method in
56
+ # `self`.
57
+ # * #public_methods: Returns an array of the symbol names of the public
58
+ # methods in `self`.
59
+ # * #respond_to?: Returns whether `self` responds to the given method.
60
+ # * #singleton_class: Returns the singleton class of `self`.
61
+ # * #singleton_method: Returns the Method object for the given singleton
62
+ # method in `self`.
63
+ # * #singleton_methods: Returns an array of the symbol names of the singleton
64
+ # methods in `self`.
112
65
  #
66
+ # * #define_singleton_method: Defines a singleton method in `self` for the
67
+ # given symbol method-name and block or proc.
68
+ # * #extend: Includes the given modules in the singleton class of `self`.
69
+ # * #public_send: Calls the given public method in `self` with the given
70
+ # argument.
71
+ # * #send: Calls the given method in `self` with the given argument.
113
72
  #
114
73
  #
115
74
  # ### Instance Variables
116
75
  #
117
- # #instance_variable_get
118
- # : Returns the value of the given instance variable in `self`, or `nil`
119
- # if the instance variable is not set.
120
- #
121
- # #instance_variable_set
122
- # : Sets the value of the given instance variable in `self` to the given
123
- # object.
124
- #
125
- # #instance_variables
126
- # : Returns an array of the symbol names of the instance variables in
127
- # `self`.
128
- #
129
- # #remove_instance_variable
130
- # : Removes the named instance variable from `self`.
131
- #
76
+ # * #instance_variable_get: Returns the value of the given instance variable
77
+ # in `self`, or `nil` if the instance variable is not set.
78
+ # * #instance_variable_set: Sets the value of the given instance variable in
79
+ # `self` to the given object.
80
+ # * #instance_variables: Returns an array of the symbol names of the instance
81
+ # variables in `self`.
82
+ # * #remove_instance_variable: Removes the named instance variable from
83
+ # `self`.
132
84
  #
133
85
  #
134
86
  # ### Other
135
87
  #
136
- # #clone
137
- # : Returns a shallow copy of `self`, including singleton class and frozen
138
- # state.
139
- #
140
- # #define_singleton_method
141
- # : Defines a singleton method in `self` for the given symbol method-name
142
- # and block or proc.
143
- #
144
- # #display
145
- # : Prints `self` to the given IO stream or `$stdout`.
146
- #
147
- # #dup
148
- # : Returns a shallow unfrozen copy of `self`.
149
- #
150
- # #enum_for (aliased as #to_enum)
151
- # : Returns an Enumerator for `self` using the using the given method,
152
- # arguments, and block.
153
- #
154
- # #extend
155
- # : Includes the given modules in the singleton class of `self`.
156
- #
157
- # #freeze
158
- # : Prevents further modifications to `self`.
159
- #
160
- # #hash
161
- # : Returns the integer hash value for `self`.
162
- #
163
- # #inspect
164
- # : Returns a human-readable string representation of `self`.
165
- #
166
- # #itself
167
- # : Returns `self`.
168
- #
169
- # #public_send
170
- # : Calls the given public method in `self` with the given argument.
171
- #
172
- # #send
173
- # : Calls the given method in `self` with the given argument.
174
- #
175
- # #to_s
176
- # : Returns a string representation of `self`.
88
+ # * #clone: Returns a shallow copy of `self`, including singleton class and
89
+ # frozen state.
90
+ # * #define_singleton_method: Defines a singleton method in `self` for the
91
+ # given symbol method-name and block or proc.
92
+ # * #display: Prints `self` to the given IO stream or `$stdout`.
93
+ # * #dup: Returns a shallow unfrozen copy of `self`.
94
+ # * #enum_for (aliased as #to_enum): Returns an Enumerator for `self` using
95
+ # the using the given method, arguments, and block.
96
+ # * #extend: Includes the given modules in the singleton class of `self`.
97
+ # * #freeze: Prevents further modifications to `self`.
98
+ # * #hash: Returns the integer hash value for `self`.
99
+ # * #inspect: Returns a human-readable string representation of `self`.
100
+ # * #itself: Returns `self`.
101
+ # * #method_missing: Method called when an undefined method is called on
102
+ # `self`.
103
+ # * #public_send: Calls the given public method in `self` with the given
104
+ # argument.
105
+ # * #send: Calls the given method in `self` with the given argument.
106
+ # * #to_s: Returns a string representation of `self`.
177
107
  #
178
108
  class Object < BasicObject
179
109
  include Kernel
@@ -217,17 +147,6 @@ class Object < BasicObject
217
147
  #
218
148
  def ===: (untyped) -> bool
219
149
 
220
- # <!--
221
- # rdoc-file=object.c
222
- # - obj =~ other -> nil
223
- # -->
224
- # This method is deprecated.
225
- #
226
- # This is not only useless but also troublesome because it may hide a type
227
- # error.
228
- #
229
- def =~: (untyped) -> bool
230
-
231
150
  # Returns the class of *obj*. This method must always be called with an explicit
232
151
  # receiver, as `class` is also a reserved word in Ruby.
233
152
  #
@@ -261,9 +180,9 @@ class Object < BasicObject
261
180
  # - define_singleton_method(symbol, method) -> symbol
262
181
  # - define_singleton_method(symbol) { block } -> symbol
263
182
  # -->
264
- # Defines a singleton method in the receiver. The *method* parameter can be a
265
- # `Proc`, a `Method` or an `UnboundMethod` object. If a block is specified, it
266
- # is used as the method body. If a block or a method has parameters, they're
183
+ # Defines a public singleton method in the receiver. The *method* parameter can
184
+ # be a `Proc`, a `Method` or an `UnboundMethod` object. If a block is specified,
185
+ # it is used as the method body. If a block or a method has parameters, they're
267
186
  # used as method parameters.
268
187
  #
269
188
  # class A
@@ -291,23 +210,16 @@ class Object < BasicObject
291
210
 
292
211
  # <!--
293
212
  # rdoc-file=io.c
294
- # - obj.display(port=$>) -> nil
213
+ # - display(port = $>) -> nil
295
214
  # -->
296
- # Prints *obj* on the given port (default `$>`). Equivalent to:
297
- #
298
- # def display(port=$>)
299
- # port.write self
300
- # nil
301
- # end
302
- #
303
- # For example:
215
+ # Writes `self` on the given port:
304
216
  #
305
217
  # 1.display
306
218
  # "cat".display
307
219
  # [ 4, 5, 6 ].display
308
220
  # puts
309
221
  #
310
- # *produces:*
222
+ # Output:
311
223
  #
312
224
  # 1cat[4, 5, 6]
313
225
  #
@@ -586,6 +498,18 @@ class Object < BasicObject
586
498
  # Certain core classes such as Integer use built-in hash calculations and do not
587
499
  # call the #hash method when used as a hash key.
588
500
  #
501
+ # When implementing your own #hash based on multiple values, the best practice
502
+ # is to combine the class and any values using the hash code of an array:
503
+ #
504
+ # For example:
505
+ #
506
+ # def hash
507
+ # [self.class, a, b, c].hash
508
+ # end
509
+ #
510
+ # The reason for this is that the Array#hash method already has logic for safely
511
+ # and efficiently combining multiple hash values.
512
+ #
589
513
  def hash: () -> Integer
590
514
 
591
515
  # <!--
@@ -1078,38 +1002,6 @@ class Object < BasicObject
1078
1002
  #
1079
1003
  def singleton_methods: () -> Array[Symbol]
1080
1004
 
1081
- # <!--
1082
- # rdoc-file=object.c
1083
- # - obj.taint -> obj
1084
- # -->
1085
- # Returns object. This method is deprecated and will be removed in Ruby 3.2.
1086
- #
1087
- def taint: () -> self
1088
-
1089
- # <!--
1090
- # rdoc-file=object.c
1091
- # - obj.untrust -> obj
1092
- # -->
1093
- # Returns object. This method is deprecated and will be removed in Ruby 3.2.
1094
- #
1095
- alias untrust taint
1096
-
1097
- # <!--
1098
- # rdoc-file=object.c
1099
- # - obj.tainted? -> false
1100
- # -->
1101
- # Returns false. This method is deprecated and will be removed in Ruby 3.2.
1102
- #
1103
- def tainted?: () -> bool
1104
-
1105
- # <!--
1106
- # rdoc-file=object.c
1107
- # - obj.untrusted? -> false
1108
- # -->
1109
- # Returns false. This method is deprecated and will be removed in Ruby 3.2.
1110
- #
1111
- alias untrusted? tainted?
1112
-
1113
1005
  # Yields self to the block, and then returns self. The primary purpose of this
1114
1006
  # method is to "tap into" a method chain, in order to perform operations on
1115
1007
  # intermediate results within the chain.
@@ -1157,22 +1049,6 @@ class Object < BasicObject
1157
1049
  #
1158
1050
  def to_s: () -> String
1159
1051
 
1160
- # <!--
1161
- # rdoc-file=object.c
1162
- # - obj.untaint -> obj
1163
- # -->
1164
- # Returns object. This method is deprecated and will be removed in Ruby 3.2.
1165
- #
1166
- def untaint: () -> self
1167
-
1168
- # <!--
1169
- # rdoc-file=object.c
1170
- # - obj.trust -> obj
1171
- # -->
1172
- # Returns object. This method is deprecated and will be removed in Ruby 3.2.
1173
- #
1174
- alias trust untaint
1175
-
1176
1052
  # Yields self to the block and returns the result of the block.
1177
1053
  #
1178
1054
  # 3.next.then {|x| x**x }.to_s #=> "256"
@@ -1202,4 +1078,4 @@ interface _Writeable
1202
1078
  def write: (untyped) -> void
1203
1079
  end
1204
1080
 
1205
- type Object::name = Symbol | String
1081
+ type Object::name = Symbol | string
data/core/proc.rbs CHANGED
@@ -51,8 +51,8 @@
51
51
  # lambda1 = lambda {|x| x**2 }
52
52
  #
53
53
  # * Use the [Lambda proc
54
- # literal](doc/syntax/literals_rdoc.html#label-Lambda+Proc+Literals) syntax
55
- # (also constructs a proc with lambda semantics):
54
+ # literal](rdoc-ref:syntax/literals.rdoc@Lambda+Proc+Literals) syntax (also
55
+ # constructs a proc with lambda semantics):
56
56
  #
57
57
  # lambda2 = ->(x) { x**2 }
58
58
  #
@@ -421,6 +421,10 @@ class Proc < Object
421
421
  # arguments to the original proc and returns the result. Otherwise, returns
422
422
  # another curried proc that takes the rest of arguments.
423
423
  #
424
+ # The optional *arity* argument should be supplied when currying procs with
425
+ # variable arguments to determine how many arguments are needed before the proc
426
+ # is called.
427
+ #
424
428
  # b = proc {|x, y, z| (x||0) + (y||0) + (z||0) }
425
429
  # p b.curry[1][2][3] #=> 6
426
430
  # p b.curry[1, 2][3, 4] #=> 6
@@ -583,14 +587,22 @@ class Proc < Object
583
587
 
584
588
  # <!--
585
589
  # rdoc-file=proc.c
586
- # - prc.parameters -> array
590
+ # - prc.parameters(lambda: nil) -> array
587
591
  # -->
588
- # Returns the parameter information of this proc.
592
+ # Returns the parameter information of this proc. If the lambda keyword is
593
+ # provided and not nil, treats the proc as a lambda if true and as a non-lambda
594
+ # if false.
589
595
  #
596
+ # prc = proc{|x, y=42, *other|}
597
+ # prc.parameters #=> [[:opt, :x], [:opt, :y], [:rest, :other]]
590
598
  # prc = lambda{|x, y=42, *other|}
591
599
  # prc.parameters #=> [[:req, :x], [:opt, :y], [:rest, :other]]
600
+ # prc = proc{|x, y=42, *other|}
601
+ # prc.parameters(lambda: true) #=> [[:req, :x], [:opt, :y], [:rest, :other]]
602
+ # prc = lambda{|x, y=42, *other|}
603
+ # prc.parameters(lambda: false) #=> [[:opt, :x], [:opt, :y], [:rest, :other]]
592
604
  #
593
- def parameters: () -> ::Array[[ Symbol, Symbol ]]
605
+ def parameters: (lambda: boolish) -> ::Array[[ Symbol, Symbol ]]
594
606
 
595
607
  # <!--
596
608
  # rdoc-file=proc.c
data/core/process.rbs CHANGED
@@ -26,6 +26,12 @@ module Process
26
26
  # You can add custom code before and after fork events by overriding this
27
27
  # method.
28
28
  #
29
+ # Note: Process.daemon may be implemented using fork(2) BUT does not go through
30
+ # this method. Thus, depending on your reason to hook into this method, you may
31
+ # also want to hook into that one. See [this
32
+ # issue](https://bugs.ruby-lang.org/issues/18911) for a more detailed discussion
33
+ # of this.
34
+ #
29
35
  def self._fork: () -> Integer
30
36
 
31
37
  # <!--
@@ -229,7 +235,7 @@ module Process
229
235
  #
230
236
  # The underlying function, clock_gettime(), returns a number of nanoseconds.
231
237
  # Float object (IEEE 754 double) is not enough to represent the return value for
232
- # CLOCK_REALTIME. If the exact nanoseconds value is required, use `:nanoseconds`
238
+ # CLOCK_REALTIME. If the exact nanoseconds value is required, use `:nanosecond`
233
239
  # as the `unit`.
234
240
  #
235
241
  # The origin (zero) of the returned value varies. For example, system start up
@@ -446,6 +452,7 @@ module Process
446
452
  # * the result is sorted
447
453
  # * the result includes effective GIDs
448
454
  # * the result does not include duplicated GIDs
455
+ # * the result size does not exceed the value of Process.maxgroups
449
456
  #
450
457
  #
451
458
  # You can make sure to get a sorted unique GID list of the current process by
@@ -474,7 +481,7 @@ module Process
474
481
  # Initializes the supplemental group access list by reading the system group
475
482
  # database and using all groups of which the given user is a member. The group
476
483
  # with the specified *gid* is also added to the list. Returns the resulting
477
- # Array of the gids of all the groups in the supplementary group access list.
484
+ # Array of the GIDs of all the groups in the supplementary group access list.
478
485
  # Not available on all platforms.
479
486
  #
480
487
  # Process.groups #=> [0, 1, 2, 3, 4, 6, 10, 11, 20, 26, 27]
@@ -485,7 +492,7 @@ module Process
485
492
 
486
493
  # <!--
487
494
  # rdoc-file=process.c
488
- # - Process.kill(signal, pid, ...) -> integer
495
+ # - Process.kill(signal, pid, *pids) -> integer
489
496
  # -->
490
497
  # Sends the given signal to the specified process id(s) if *pid* is positive. If
491
498
  # *pid* is zero, *signal* is sent to all processes whose group ID is equal to
@@ -522,7 +529,7 @@ module Process
522
529
  # rdoc-file=process.c
523
530
  # - Process.maxgroups -> integer
524
531
  # -->
525
- # Returns the maximum number of gids allowed in the supplemental group access
532
+ # Returns the maximum number of GIDs allowed in the supplemental group access
526
533
  # list.
527
534
  #
528
535
  # Process.maxgroups #=> 32
@@ -533,7 +540,7 @@ module Process
533
540
  # rdoc-file=process.c
534
541
  # - Process.maxgroups= integer -> integer
535
542
  # -->
536
- # Sets the maximum number of gids allowed in the supplemental group access list.
543
+ # Sets the maximum number of GIDs allowed in the supplemental group access list.
537
544
  #
538
545
  def self.maxgroups=: (Integer arg0) -> Integer
539
546
 
@@ -640,6 +647,8 @@ module Process
640
647
  # : file descriptors (number) (SUSv3)
641
648
  # NPROC
642
649
  # : number of processes for the user (number) (4.4BSD, GNU/Linux)
650
+ # NPTS
651
+ # : number of pseudo terminals (number) (FreeBSD)
643
652
  # RSS
644
653
  # : resident memory size (bytes) (4.2BSD, GNU/Linux)
645
654
  # RTPRIO
@@ -996,6 +1005,14 @@ Process::RLIMIT_NOFILE: Integer
996
1005
  #
997
1006
  Process::RLIMIT_NPROC: Integer
998
1007
 
1008
+ # <!-- rdoc-file=process.c -->
1009
+ # The maximum number of pseudo-terminals that can be created for the real user
1010
+ # ID of the calling process.
1011
+ #
1012
+ # see the system getrlimit(2) manual for details.
1013
+ #
1014
+ Process::RLIMIT_NPTS: Integer
1015
+
999
1016
  # <!-- rdoc-file=process.c -->
1000
1017
  # Specifies the limit (in pages) of the process's resident set.
1001
1018
  #
data/core/ractor.rbs CHANGED
@@ -1,5 +1,5 @@
1
1
  # <!-- rdoc-file=ractor.rb -->
2
- # Ractor is a Actor-model abstraction for Ruby that provides thread-safe
2
+ # Ractor is an Actor-model abstraction for Ruby that provides thread-safe
3
3
  # parallel execution.
4
4
  #
5
5
  # Ractor.new can make a new Ractor, and it will run in parallel.
data/core/random.rbs CHANGED
@@ -20,6 +20,9 @@
20
20
  # of 2**19937-1. As this algorithm is *not* for cryptographical use, you must
21
21
  # use SecureRandom for security purpose, instead of this PRNG.
22
22
  #
23
+ # See also Random::Formatter module that adds convenience methods to generate
24
+ # various forms of random data.
25
+ #
23
26
  class Random < RBS::Unnamed::Random_Base
24
27
  # <!--
25
28
  # rdoc-file=random.c
@@ -164,15 +167,18 @@ class Random < RBS::Unnamed::Random_Base
164
167
  def state: () -> untyped
165
168
  end
166
169
 
167
- Random::DEFAULT: Random
168
-
169
170
  class Random::Base < RBS::Unnamed::Random_Base
170
171
  end
171
172
 
172
173
  # <!-- rdoc-file=lib/random/formatter.rb -->
173
174
  # ## Random number formatter.
174
175
  #
175
- # Formats generated random numbers in many manners.
176
+ # Formats generated random numbers in many manners. When `'random/formatter'` is
177
+ # required, several methods are added to empty core module `Random::Formatter`,
178
+ # making them available as Random's instance and module methods.
179
+ #
180
+ # Standard library SecureRandom is also extended with the module, and the
181
+ # methods described below are available as a module methods in it.
176
182
  #
177
183
  # ### Examples
178
184
  #
@@ -180,30 +186,41 @@ end
180
186
  #
181
187
  # require 'random/formatter'
182
188
  #
189
+ # prng = Random.new
183
190
  # prng.hex(10) #=> "52750b30ffbc7de3b362"
184
191
  # prng.hex(10) #=> "92b15d6c8dc4beb5f559"
185
192
  # prng.hex(13) #=> "39b290146bea6ce975c37cfc23"
193
+ # # or just
194
+ # Random.hex #=> "1aed0c631e41be7f77365415541052ee"
186
195
  #
187
196
  # Generate random base64 strings:
188
197
  #
189
198
  # prng.base64(10) #=> "EcmTPZwWRAozdA=="
190
199
  # prng.base64(10) #=> "KO1nIU+p9DKxGg=="
191
200
  # prng.base64(12) #=> "7kJSM/MzBJI+75j8"
201
+ # Random.base64(4) #=> "bsQ3fQ=="
192
202
  #
193
203
  # Generate random binary strings:
194
204
  #
195
205
  # prng.random_bytes(10) #=> "\016\t{\370g\310pbr\301"
196
206
  # prng.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337"
207
+ # Random.random_bytes(6) #=> "\xA1\xE6Lr\xC43"
197
208
  #
198
209
  # Generate alphanumeric strings:
199
210
  #
200
211
  # prng.alphanumeric(10) #=> "S8baxMJnPl"
201
212
  # prng.alphanumeric(10) #=> "aOxAg8BAJe"
213
+ # Random.alphanumeric #=> "TmP9OsJHJLtaZYhP"
202
214
  #
203
215
  # Generate UUIDs:
204
216
  #
205
217
  # prng.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594"
206
218
  # prng.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab"
219
+ # Random.uuid #=> "f14e0271-de96-45cc-8911-8910292a42cd"
220
+ #
221
+ # All methods are available in the standard library SecureRandom, too:
222
+ #
223
+ # SecureRandom.hex #=> "05b45376a30c67238eb93b16499e50cf"
207
224
  #
208
225
  # <!-- rdoc-file=random.c -->
209
226
  # Generate a random number in the given range as Random does