rbs 3.3.1 → 3.4.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -5
  3. data/.github/workflows/ruby.yml +7 -8
  4. data/.github/workflows/typecheck.yml +37 -0
  5. data/CHANGELOG.md +56 -0
  6. data/Gemfile +1 -1
  7. data/Gemfile.lock +11 -11
  8. data/Steepfile +2 -2
  9. data/core/array.rbs +19 -49
  10. data/core/basic_object.rbs +2 -2
  11. data/core/comparable.rbs +17 -8
  12. data/core/complex.rbs +82 -43
  13. data/core/data.rbs +2 -4
  14. data/core/dir.rbs +635 -295
  15. data/core/enumerable.rbs +11 -18
  16. data/core/enumerator.rbs +37 -31
  17. data/core/errors.rbs +4 -0
  18. data/core/false_class.rbs +34 -15
  19. data/core/fiber.rbs +23 -0
  20. data/core/file.rbs +329 -120
  21. data/core/float.rbs +17 -32
  22. data/core/gc.rbs +17 -11
  23. data/core/hash.rbs +22 -44
  24. data/core/integer.rbs +82 -113
  25. data/core/io/buffer.rbs +90 -47
  26. data/core/io.rbs +39 -116
  27. data/core/kernel.rbs +442 -489
  28. data/core/match_data.rbs +55 -56
  29. data/core/module.rbs +45 -1
  30. data/core/nil_class.rbs +98 -35
  31. data/core/numeric.rbs +22 -32
  32. data/core/object_space/weak_key_map.rbs +102 -0
  33. data/core/process.rbs +1242 -655
  34. data/core/ractor.rbs +139 -120
  35. data/core/range.rbs +100 -4
  36. data/core/rational.rbs +0 -4
  37. data/core/rbs/unnamed/argf.rbs +16 -8
  38. data/core/rbs/unnamed/env_class.rbs +0 -24
  39. data/core/refinement.rbs +8 -0
  40. data/core/regexp.rbs +1149 -598
  41. data/core/ruby_vm.rbs +126 -12
  42. data/core/rubygems/platform.rbs +9 -0
  43. data/core/rubygems/rubygems.rbs +1 -1
  44. data/core/rubygems/version.rbs +5 -1
  45. data/core/set.rbs +20 -22
  46. data/core/signal.rbs +4 -4
  47. data/core/string.rbs +283 -230
  48. data/core/string_io.rbs +2 -14
  49. data/core/struct.rbs +404 -24
  50. data/core/symbol.rbs +1 -19
  51. data/core/thread.rbs +29 -12
  52. data/core/time.rbs +227 -104
  53. data/core/trace_point.rbs +2 -5
  54. data/core/true_class.rbs +54 -21
  55. data/core/warning.rbs +14 -11
  56. data/docs/data_and_struct.md +29 -0
  57. data/docs/syntax.md +3 -5
  58. data/docs/tools.md +1 -0
  59. data/ext/rbs_extension/lexer.c +643 -559
  60. data/ext/rbs_extension/lexer.re +5 -1
  61. data/ext/rbs_extension/parser.c +12 -3
  62. data/ext/rbs_extension/unescape.c +7 -47
  63. data/lib/rbs/cli/diff.rb +4 -1
  64. data/lib/rbs/cli/validate.rb +280 -0
  65. data/lib/rbs/cli.rb +2 -194
  66. data/lib/rbs/collection/config.rb +5 -6
  67. data/lib/rbs/collection/sources/git.rb +1 -1
  68. data/lib/rbs/collection.rb +1 -0
  69. data/lib/rbs/diff.rb +7 -4
  70. data/lib/rbs/errors.rb +11 -0
  71. data/lib/rbs/test/errors.rb +4 -1
  72. data/lib/rbs/test/guaranteed.rb +2 -3
  73. data/lib/rbs/test/type_check.rb +15 -10
  74. data/lib/rbs/test.rb +3 -3
  75. data/lib/rbs/types.rb +29 -0
  76. data/lib/rbs/unit_test/convertibles.rb +176 -0
  77. data/lib/rbs/unit_test/spy.rb +136 -0
  78. data/lib/rbs/unit_test/type_assertions.rb +341 -0
  79. data/lib/rbs/unit_test/with_aliases.rb +143 -0
  80. data/lib/rbs/unit_test.rb +6 -0
  81. data/lib/rbs/version.rb +1 -1
  82. data/sig/cli/validate.rbs +43 -0
  83. data/sig/diff.rbs +3 -1
  84. data/sig/errors.rbs +8 -0
  85. data/sig/rbs.rbs +1 -1
  86. data/sig/test/errors.rbs +52 -0
  87. data/sig/test/guranteed.rbs +9 -0
  88. data/sig/test/type_check.rbs +19 -0
  89. data/sig/test.rbs +82 -0
  90. data/sig/types.rbs +6 -1
  91. data/sig/unit_test/convertibles.rbs +154 -0
  92. data/sig/unit_test/spy.rbs +28 -0
  93. data/sig/unit_test/type_assertions.rbs +194 -0
  94. data/sig/unit_test/with_aliases.rbs +136 -0
  95. data/stdlib/base64/0/base64.rbs +307 -45
  96. data/stdlib/bigdecimal/0/big_decimal.rbs +35 -15
  97. data/stdlib/coverage/0/coverage.rbs +2 -2
  98. data/stdlib/csv/0/csv.rbs +25 -55
  99. data/stdlib/date/0/date.rbs +1 -43
  100. data/stdlib/date/0/date_time.rbs +1 -13
  101. data/stdlib/delegate/0/delegator.rbs +186 -0
  102. data/stdlib/delegate/0/kernel.rbs +47 -0
  103. data/stdlib/delegate/0/simple_delegator.rbs +98 -0
  104. data/stdlib/did_you_mean/0/did_you_mean.rbs +1 -1
  105. data/stdlib/erb/0/erb.rbs +2 -2
  106. data/stdlib/fileutils/0/fileutils.rbs +0 -19
  107. data/stdlib/io-console/0/io-console.rbs +12 -1
  108. data/stdlib/ipaddr/0/ipaddr.rbs +2 -1
  109. data/stdlib/json/0/json.rbs +320 -81
  110. data/stdlib/logger/0/logger.rbs +9 -5
  111. data/stdlib/monitor/0/monitor.rbs +78 -0
  112. data/stdlib/net-http/0/net-http.rbs +1880 -543
  113. data/stdlib/objspace/0/objspace.rbs +19 -13
  114. data/stdlib/openssl/0/openssl.rbs +508 -127
  115. data/stdlib/optparse/0/optparse.rbs +25 -11
  116. data/stdlib/pathname/0/pathname.rbs +1 -1
  117. data/stdlib/pp/0/pp.rbs +2 -5
  118. data/stdlib/prettyprint/0/prettyprint.rbs +2 -2
  119. data/stdlib/pstore/0/pstore.rbs +2 -4
  120. data/stdlib/rdoc/0/comment.rbs +1 -2
  121. data/stdlib/resolv/0/resolv.rbs +4 -2
  122. data/stdlib/socket/0/socket.rbs +2 -2
  123. data/stdlib/socket/0/unix_socket.rbs +2 -2
  124. data/stdlib/strscan/0/string_scanner.rbs +3 -2
  125. data/stdlib/tempfile/0/tempfile.rbs +1 -1
  126. data/stdlib/uri/0/common.rbs +245 -123
  127. metadata +23 -4
  128. data/lib/rbs/test/spy.rb +0 -6
data/core/float.rbs CHANGED
@@ -6,8 +6,8 @@
6
6
  # should know its esoteric system. See following:
7
7
  #
8
8
  # * https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
9
- # * https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#floats_impre
10
- # cise
9
+ # * https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#-why-are-rub
10
+ # ys-floats-imprecise
11
11
  # * https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
12
12
  #
13
13
  #
@@ -109,8 +109,6 @@ class Float < Numeric
109
109
  # 10.0 % 4.0 # => 2.0
110
110
  # 10.0 % Rational(4, 1) # => 2.0
111
111
  #
112
- # Float#modulo is an alias for Float#%.
113
- #
114
112
  def %: (Integer) -> Float
115
113
  | (Float) -> Float
116
114
  | (Rational) -> Float
@@ -181,9 +179,9 @@ class Float < Numeric
181
179
 
182
180
  # <!--
183
181
  # rdoc-file=numeric.rb
184
- # - -float -> float
182
+ # - -float -> float
185
183
  # -->
186
- # Returns `float`, negated.
184
+ # Returns `self`, negated.
187
185
  #
188
186
  def -@: () -> Float
189
187
 
@@ -326,16 +324,13 @@ class Float < Numeric
326
324
 
327
325
  # <!--
328
326
  # rdoc-file=numeric.rb
329
- # - float.abs -> float
330
- # - float.magnitude -> float
327
+ # - float.abs -> float
331
328
  # -->
332
- # Returns the absolute value of `float`.
333
- #
334
- # (-34.56).abs #=> 34.56
335
- # -34.56.abs #=> 34.56
336
- # 34.56.abs #=> 34.56
329
+ # Returns the absolute value of `self`:
337
330
  #
338
- # Float#magnitude is an alias for Float#abs.
331
+ # (-34.56).abs # => 34.56
332
+ # -34.56.abs # => 34.56
333
+ # 34.56.abs # => 34.56
339
334
  #
340
335
  def abs: () -> Float
341
336
 
@@ -481,8 +476,6 @@ class Float < Numeric
481
476
  # f.quo(Rational(2, 1)) # => 1.57
482
477
  # f.quo(Complex(2, 0)) # => (1.57+0.0i)
483
478
  #
484
- # Float#fdiv is an alias for Float#quo.
485
- #
486
479
  def fdiv: (Complex) -> Complex
487
480
  | (Numeric) -> Float
488
481
 
@@ -630,8 +623,6 @@ class Float < Numeric
630
623
  # 10.0 % 4.0 # => 2.0
631
624
  # 10.0 % Rational(4, 1) # => 2.0
632
625
  #
633
- # Float#modulo is an alias for Float#%.
634
- #
635
626
  def modulo: (Numeric) -> Float
636
627
 
637
628
  # <!--
@@ -649,9 +640,9 @@ class Float < Numeric
649
640
 
650
641
  # <!--
651
642
  # rdoc-file=numeric.rb
652
- # - float.negative? -> true or false
643
+ # - negative? -> true or false
653
644
  # -->
654
- # Returns `true` if `float` is less than 0.
645
+ # Returns `true` if `self` is less than 0, `false` otherwise.
655
646
  #
656
647
  def negative?: () -> bool
657
648
 
@@ -725,9 +716,9 @@ class Float < Numeric
725
716
 
726
717
  # <!--
727
718
  # rdoc-file=numeric.rb
728
- # - float.positive? -> true or false
719
+ # - positive? -> true or false
729
720
  # -->
730
- # Returns `true` if `float` is greater than 0.
721
+ # Returns `true` if `self` is greater than 0, `false` otherwise.
731
722
  #
732
723
  def positive?: () -> bool
733
724
 
@@ -779,8 +770,6 @@ class Float < Numeric
779
770
  # f.quo(Rational(2, 1)) # => 1.57
780
771
  # f.quo(Complex(2, 0)) # => (1.57+0.0i)
781
772
  #
782
- # Float#fdiv is an alias for Float#quo.
783
- #
784
773
  def quo: (Complex) -> Complex
785
774
  | (Numeric) -> Float
786
775
 
@@ -875,9 +864,9 @@ class Float < Numeric
875
864
 
876
865
  # <!--
877
866
  # rdoc-file=numeric.rb
878
- # - float.to_f -> self
867
+ # - to_f -> self
879
868
  # -->
880
- # Since `float` is already a Float, returns `self`.
869
+ # Returns `self` (which is already a Float).
881
870
  #
882
871
  def to_f: () -> Float
883
872
 
@@ -895,8 +884,6 @@ class Float < Numeric
895
884
  #
896
885
  # (0.3 / 0.1).to_i # => 2 (!)
897
886
  #
898
- # Float#to_int is an alias for Float#to_i.
899
- #
900
887
  def to_i: () -> Integer
901
888
 
902
889
  # <!-- rdoc-file=numeric.c -->
@@ -910,8 +897,6 @@ class Float < Numeric
910
897
  #
911
898
  # (0.3 / 0.1).to_i # => 2 (!)
912
899
  #
913
- # Float#to_int is an alias for Float#to_i.
914
- #
915
900
  alias to_int to_i
916
901
 
917
902
  # <!--
@@ -994,9 +979,9 @@ class Float < Numeric
994
979
 
995
980
  # <!--
996
981
  # rdoc-file=numeric.rb
997
- # - float.zero? -> true or false
982
+ # - zero? -> true or false
998
983
  # -->
999
- # Returns `true` if `float` is 0.0.
984
+ # Returns `true` if `self` is 0.0, `false` otherwise.
1000
985
  #
1001
986
  def zero?: () -> bool
1002
987
  end
data/core/gc.rbs CHANGED
@@ -44,21 +44,27 @@ module GC
44
44
 
45
45
  # <!--
46
46
  # rdoc-file=gc.rb
47
- # - GC.start -> nil
48
- # - ObjectSpace.garbage_collect -> nil
49
- # - include GC; garbage_collect -> nil
50
- # - GC.start(full_mark: true, immediate_sweep: true) -> nil
51
- # - ObjectSpace.garbage_collect(full_mark: true, immediate_sweep: true) -> nil
52
- # - include GC; garbage_collect(full_mark: true, immediate_sweep: true) -> nil
47
+ # - start(full_mark: true, immediate_mark: true, immediate_sweep: true)
53
48
  # -->
54
49
  # Initiates garbage collection, even if manually disabled.
55
50
  #
56
- # This method is defined with keyword arguments that default to true:
51
+ # The `full_mark` keyword argument determines whether or not to perform a major
52
+ # garbage collection cycle. When set to `true`, a major garbage collection cycle
53
+ # is ran, meaning all objects are marked. When set to `false`, a minor garbage
54
+ # collection cycle is ran, meaning only young objects are marked.
57
55
  #
58
- # def GC.start(full_mark: true, immediate_sweep: true); end
56
+ # The `immediate_mark` keyword argument determines whether or not to perform
57
+ # incremental marking. When set to `true`, marking is completed during the call
58
+ # to this method. When set to `false`, marking is performed in steps that is
59
+ # interleaved with future Ruby code execution, so marking might not be completed
60
+ # during this method call. Note that if `full_mark` is `false` then marking will
61
+ # always be immediate, regardless of the value of `immediate_mark`.
59
62
  #
60
- # Use full_mark: false to perform a minor GC. Use immediate_sweep: false to
61
- # defer sweeping (use lazy sweep).
63
+ # The `immedate_sweep` keyword argument determines whether or not to defer
64
+ # sweeping (using lazy sweep). When set to `true`, sweeping is performed in
65
+ # steps that is interleaved with future Ruby code execution, so sweeping might
66
+ # not be completed during this method call. When set to `false`, sweeping is
67
+ # completed during the call to this method.
62
68
  #
63
69
  # Note: These keyword arguments are implementation and version dependent. They
64
70
  # are not guaranteed to be future-compatible, and may be ignored if the
@@ -258,7 +264,7 @@ module GC
258
264
  end
259
265
 
260
266
  # <!-- rdoc-file=gc.c -->
261
- # internal constants
267
+ # Internal constants in the garbage collector.
262
268
  #
263
269
  GC::INTERNAL_CONSTANTS: Hash[Symbol, Integer]
264
270
 
data/core/hash.rbs CHANGED
@@ -247,7 +247,7 @@
247
247
  # alias eql? ==
248
248
  #
249
249
  # def hash
250
- # @author.hash ^ @title.hash # XOR
250
+ # [self.class, @author, @title].hash
251
251
  # end
252
252
  # end
253
253
  #
@@ -345,6 +345,10 @@
345
345
  # Note that setting the default proc will clear the default value and vice
346
346
  # versa.
347
347
  #
348
+ # Be aware that a default proc that modifies the hash is not thread-safe in the
349
+ # sense that multiple threads can call into the default proc concurrently for
350
+ # the same key.
351
+ #
348
352
  # ### What's Here
349
353
  #
350
354
  # First, what's elsewhere. Class Hash:
@@ -412,7 +416,7 @@
412
416
  # * #<=: Returns whether `self` is a subset of a given object.
413
417
  # * #==: Returns whether a given object is equal to `self`.
414
418
  # * #>: Returns whether `self` is a proper superset of a given object
415
- # * #>=: Returns whether `self` is a proper superset of a given object.
419
+ # * #>=: Returns whether `self` is a superset of a given object.
416
420
  #
417
421
  #
418
422
  # #### Methods for Fetching
@@ -499,6 +503,12 @@
499
503
  class Hash[unchecked out K, unchecked out V] < Object
500
504
  include Enumerable[[ K, V ]]
501
505
 
506
+ interface _Key
507
+ def hash: () -> Integer
508
+
509
+ def eql?: (untyped rhs) -> boolish
510
+ end
511
+
502
512
  # <!--
503
513
  # rdoc-file=hash.c
504
514
  # - Hash[] -> new_empty_hash
@@ -646,8 +656,6 @@ class Hash[unchecked out K, unchecked out V] < Object
646
656
  # - hash[key] = value -> value
647
657
  # - hash.store(key, value)
648
658
  # -->
649
- # Hash#store is an alias for Hash#[]=.
650
- #
651
659
  # Associates the given `value` with the given `key`; returns `value`.
652
660
  #
653
661
  # If the given `key` exists, replaces its value with the given `value`; the
@@ -674,6 +682,8 @@ class Hash[unchecked out K, unchecked out V] < Object
674
682
  # -->
675
683
  # Returns `true` if any element satisfies a given criterion; `false` otherwise.
676
684
  #
685
+ # If `self` has no element, returns `false` and argument or block are not used.
686
+ #
677
687
  # With no argument and no block, returns `true` if `self` is non-empty; `false`
678
688
  # if empty.
679
689
  #
@@ -690,6 +700,8 @@ class Hash[unchecked out K, unchecked out V] < Object
690
700
  # h.any? {|key, value| value < 3 } # => true
691
701
  # h.any? {|key, value| value > 3 } # => false
692
702
  #
703
+ # Related: Enumerable#any?
704
+ #
693
705
  def any?: () -> bool
694
706
  | (untyped pattern) -> bool
695
707
  | () { (K, V) -> boolish } -> bool
@@ -922,8 +934,6 @@ class Hash[unchecked out K, unchecked out V] < Object
922
934
  def dig: (K, *untyped) -> untyped
923
935
 
924
936
  # <!-- rdoc-file=hash.c -->
925
- # Hash#each is an alias for Hash#each_pair.
926
- #
927
937
  # Calls the given block with each key-value pair; returns `self`:
928
938
  # h = {foo: 0, bar: 1, baz: 2}
929
939
  # h.each_pair {|key, value| puts "#{key}: #{value}"} # => {:foo=>0, :bar=>1, :baz=>2}
@@ -982,8 +992,6 @@ class Hash[unchecked out K, unchecked out V] < Object
982
992
  # - hash.each -> new_enumerator
983
993
  # - hash.each_pair -> new_enumerator
984
994
  # -->
985
- # Hash#each is an alias for Hash#each_pair.
986
- #
987
995
  # Calls the given block with each key-value pair; returns `self`:
988
996
  # h = {foo: 0, bar: 1, baz: 2}
989
997
  # h.each_pair {|key, value| puts "#{key}: #{value}"} # => {:foo=>0, :bar=>1, :baz=>2}
@@ -1127,8 +1135,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1127
1135
  | [X] (*K) { (K) -> X } -> ::Array[V | X]
1128
1136
 
1129
1137
  # <!-- rdoc-file=hash.c -->
1130
- # Hash#filter is an alias for Hash#select.
1131
- #
1132
1138
  # Returns a new Hash object whose entries are those for which the block returns
1133
1139
  # a truthy value:
1134
1140
  # h = {foo: 0, bar: 1, baz: 2}
@@ -1143,8 +1149,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1143
1149
  | () -> ::Enumerator[[ K, V ], ::Hash[K, V]]
1144
1150
 
1145
1151
  # <!-- rdoc-file=hash.c -->
1146
- # Hash#filter! is an alias for Hash#select!.
1147
- #
1148
1152
  # Returns `self`, whose entries are those for which the block returns a truthy
1149
1153
  # value:
1150
1154
  # h = {foo: 0, bar: 1, baz: 2}
@@ -1195,8 +1199,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1195
1199
  | (Integer level) -> Array[untyped]
1196
1200
 
1197
1201
  # <!-- rdoc-file=hash.c -->
1198
- # Methods #has_key?, #key?, and #member? are aliases for #include?.
1199
- #
1200
1202
  # Returns `true` if `key` is a key in `self`, otherwise `false`.
1201
1203
  #
1202
1204
  def has_key?: (K arg0) -> bool
@@ -1206,8 +1208,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1206
1208
  # - hash.has_value?(value) -> true or false
1207
1209
  # - hash.value?(value) -> true or false
1208
1210
  # -->
1209
- # Method #value? is an alias for #has_value?.
1210
- #
1211
1211
  # Returns `true` if `value` is a value in `self`, otherwise `false`.
1212
1212
  #
1213
1213
  def has_value?: (V arg0) -> bool
@@ -1219,7 +1219,7 @@ class Hash[unchecked out K, unchecked out V] < Object
1219
1219
  # Returns the Integer hash-code for the hash.
1220
1220
  #
1221
1221
  # Two Hash objects have the same hash-code if their content is the same
1222
- # (regardless or order):
1222
+ # (regardless of order):
1223
1223
  # h1 = {foo: 0, bar: 1, baz: 2}
1224
1224
  # h2 = {baz: 2, bar: 1, foo: 0}
1225
1225
  # h2.hash == h1.hash # => true
@@ -1234,8 +1234,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1234
1234
  # - hash.key?(key) -> true or false
1235
1235
  # - hash.member?(key) -> true or false
1236
1236
  # -->
1237
- # Methods #has_key?, #key?, and #member? are aliases for #include?.
1238
- #
1239
1237
  # Returns `true` if `key` is a key in `self`, otherwise `false`.
1240
1238
  #
1241
1239
  alias include? has_key?
@@ -1245,11 +1243,10 @@ class Hash[unchecked out K, unchecked out V] < Object
1245
1243
  # - hash.inspect -> new_string
1246
1244
  # -->
1247
1245
  # Returns a new String containing the hash entries:
1246
+ #
1248
1247
  # h = {foo: 0, bar: 1, baz: 2}
1249
1248
  # h.inspect # => "{:foo=>0, :bar=>1, :baz=>2}"
1250
1249
  #
1251
- # Hash#to_s is an alias for Hash#inspect.
1252
- #
1253
1250
  def inspect: () -> String
1254
1251
 
1255
1252
  # <!--
@@ -1296,13 +1293,11 @@ class Hash[unchecked out K, unchecked out V] < Object
1296
1293
  # h.key(0) # => :foo
1297
1294
  # h.key(2) # => :bar
1298
1295
  #
1299
- # Returns `nil` if so such value is found.
1296
+ # Returns `nil` if no such value is found.
1300
1297
  #
1301
1298
  def key: (V) -> K?
1302
1299
 
1303
1300
  # <!-- rdoc-file=hash.c -->
1304
- # Methods #has_key?, #key?, and #member? are aliases for #include?.
1305
- #
1306
1301
  # Returns `true` if `key` is a key in `self`, otherwise `false`.
1307
1302
  #
1308
1303
  alias key? has_key?
@@ -1319,15 +1314,12 @@ class Hash[unchecked out K, unchecked out V] < Object
1319
1314
 
1320
1315
  # <!-- rdoc-file=hash.c -->
1321
1316
  # Returns the count of entries in `self`:
1322
- # {foo: 0, bar: 1, baz: 2}.length # => 3
1323
1317
  #
1324
- # Hash#length is an alias for Hash#size.
1318
+ # {foo: 0, bar: 1, baz: 2}.length # => 3
1325
1319
  #
1326
1320
  def length: () -> Integer
1327
1321
 
1328
1322
  # <!-- rdoc-file=hash.c -->
1329
- # Methods #has_key?, #key?, and #member? are aliases for #include?.
1330
- #
1331
1323
  # Returns `true` if `key` is a key in `self`, otherwise `false`.
1332
1324
  #
1333
1325
  alias member? has_key?
@@ -1394,8 +1386,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1394
1386
  #
1395
1387
  # Each argument in `other_hashes` must be a Hash.
1396
1388
  #
1397
- # Method #update is an alias for #merge!.
1398
- #
1399
1389
  # With arguments and no block:
1400
1390
  # * Returns `self`, after the given hashes are merged into it.
1401
1391
  # * The given hashes are merged left to right.
@@ -1520,8 +1510,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1520
1510
  # - hash.select {|key, value| ... } -> new_hash
1521
1511
  # - hash.select -> new_enumerator
1522
1512
  # -->
1523
- # Hash#filter is an alias for Hash#select.
1524
- #
1525
1513
  # Returns a new Hash object whose entries are those for which the block returns
1526
1514
  # a truthy value:
1527
1515
  # h = {foo: 0, bar: 1, baz: 2}
@@ -1539,8 +1527,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1539
1527
  # - hash.select! {|key, value| ... } -> self or nil
1540
1528
  # - hash.select! -> new_enumerator
1541
1529
  # -->
1542
- # Hash#filter! is an alias for Hash#select!.
1543
- #
1544
1530
  # Returns `self`, whose entries are those for which the block returns a truthy
1545
1531
  # value:
1546
1532
  # h = {foo: 0, bar: 1, baz: 2}
@@ -1575,9 +1561,8 @@ class Hash[unchecked out K, unchecked out V] < Object
1575
1561
  # - hash.size -> integer
1576
1562
  # -->
1577
1563
  # Returns the count of entries in `self`:
1578
- # {foo: 0, bar: 1, baz: 2}.length # => 3
1579
1564
  #
1580
- # Hash#length is an alias for Hash#size.
1565
+ # {foo: 0, bar: 1, baz: 2}.length # => 3
1581
1566
  #
1582
1567
  alias size length
1583
1568
 
@@ -1594,8 +1579,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1594
1579
  def slice: (*K) -> ::Hash[K, V]
1595
1580
 
1596
1581
  # <!-- rdoc-file=hash.c -->
1597
- # Hash#store is an alias for Hash#[]=.
1598
- #
1599
1582
  # Associates the given `value` with the given `key`; returns `value`.
1600
1583
  #
1601
1584
  # If the given `key` exists, replaces its value with the given `value`; the
@@ -1668,11 +1651,10 @@ class Hash[unchecked out K, unchecked out V] < Object
1668
1651
 
1669
1652
  # <!-- rdoc-file=hash.c -->
1670
1653
  # Returns a new String containing the hash entries:
1654
+ #
1671
1655
  # h = {foo: 0, bar: 1, baz: 2}
1672
1656
  # h.inspect # => "{:foo=>0, :bar=>1, :baz=>2}"
1673
1657
  #
1674
- # Hash#to_s is an alias for Hash#inspect.
1675
- #
1676
1658
  alias to_s inspect
1677
1659
 
1678
1660
  # <!--
@@ -1782,8 +1764,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1782
1764
  #
1783
1765
  # Each argument in `other_hashes` must be a Hash.
1784
1766
  #
1785
- # Method #update is an alias for #merge!.
1786
- #
1787
1767
  # With arguments and no block:
1788
1768
  # * Returns `self`, after the given hashes are merged into it.
1789
1769
  # * The given hashes are merged left to right.
@@ -1828,8 +1808,6 @@ class Hash[unchecked out K, unchecked out V] < Object
1828
1808
  alias update merge!
1829
1809
 
1830
1810
  # <!-- rdoc-file=hash.c -->
1831
- # Method #value? is an alias for #has_value?.
1832
- #
1833
1811
  # Returns `true` if `value` is a value in `self`, otherwise `false`.
1834
1812
  #
1835
1813
  alias value? has_value?