rbs 3.10.2 → 4.0.0.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 (205) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -2
  3. data/.github/workflows/ruby.yml +24 -34
  4. data/.github/workflows/typecheck.yml +3 -1
  5. data/.github/workflows/windows.yml +2 -2
  6. data/.gitignore +0 -4
  7. data/CHANGELOG.md +0 -107
  8. data/README.md +1 -38
  9. data/Rakefile +20 -142
  10. data/Steepfile +1 -0
  11. data/config.yml +43 -1
  12. data/core/array.rbs +46 -96
  13. data/core/comparable.rbs +6 -13
  14. data/core/complex.rbs +25 -40
  15. data/core/dir.rbs +4 -4
  16. data/core/encoding.rbs +9 -6
  17. data/core/enumerable.rbs +3 -90
  18. data/core/enumerator.rbs +1 -43
  19. data/core/errno.rbs +0 -8
  20. data/core/errors.rbs +1 -28
  21. data/core/exception.rbs +2 -2
  22. data/core/fiber.rbs +20 -29
  23. data/core/file.rbs +19 -49
  24. data/core/file_test.rbs +1 -1
  25. data/core/float.rbs +33 -224
  26. data/core/gc.rbs +281 -417
  27. data/core/hash.rbs +727 -1023
  28. data/core/integer.rbs +63 -104
  29. data/core/io/buffer.rbs +10 -21
  30. data/core/io/wait.rbs +33 -11
  31. data/core/io.rbs +12 -14
  32. data/core/kernel.rbs +51 -61
  33. data/core/marshal.rbs +1 -1
  34. data/core/match_data.rbs +1 -1
  35. data/core/math.rbs +3 -42
  36. data/core/method.rbs +25 -63
  37. data/core/module.rbs +23 -101
  38. data/core/nil_class.rbs +3 -3
  39. data/core/numeric.rbs +17 -25
  40. data/core/object.rbs +3 -3
  41. data/core/object_space.rbs +15 -21
  42. data/core/proc.rbs +24 -30
  43. data/core/process.rbs +2 -2
  44. data/core/ractor.rbs +509 -361
  45. data/core/range.rbs +8 -7
  46. data/core/rational.rbs +34 -56
  47. data/core/rbs/unnamed/argf.rbs +2 -2
  48. data/core/rbs/unnamed/env_class.rbs +1 -1
  49. data/core/rbs/unnamed/random.rbs +2 -4
  50. data/core/regexp.rbs +20 -25
  51. data/core/ruby_vm.rbs +4 -6
  52. data/core/rubygems/errors.rbs +70 -3
  53. data/core/rubygems/rubygems.rbs +79 -11
  54. data/core/rubygems/version.rbs +3 -2
  55. data/core/set.rbs +359 -488
  56. data/core/signal.rbs +14 -24
  57. data/core/string.rbs +1236 -3165
  58. data/core/struct.rbs +1 -1
  59. data/core/symbol.rbs +11 -17
  60. data/core/thread.rbs +33 -95
  61. data/core/time.rbs +9 -35
  62. data/core/trace_point.rbs +4 -7
  63. data/core/unbound_method.rbs +6 -14
  64. data/docs/collection.md +2 -2
  65. data/docs/gem.md +1 -0
  66. data/docs/sigs.md +3 -3
  67. data/ext/rbs_extension/ast_translation.c +1077 -944
  68. data/ext/rbs_extension/ast_translation.h +0 -7
  69. data/ext/rbs_extension/class_constants.c +83 -71
  70. data/ext/rbs_extension/class_constants.h +7 -4
  71. data/ext/rbs_extension/extconf.rb +2 -24
  72. data/ext/rbs_extension/legacy_location.c +172 -173
  73. data/ext/rbs_extension/legacy_location.h +3 -8
  74. data/ext/rbs_extension/main.c +289 -239
  75. data/ext/rbs_extension/rbs_extension.h +0 -3
  76. data/ext/rbs_extension/rbs_string_bridging.h +0 -4
  77. data/include/rbs/ast.h +98 -37
  78. data/include/rbs/defines.h +12 -38
  79. data/include/rbs/lexer.h +114 -126
  80. data/include/rbs/location.h +14 -14
  81. data/include/rbs/parser.h +37 -21
  82. data/include/rbs/string.h +5 -3
  83. data/include/rbs/util/rbs_allocator.h +19 -40
  84. data/include/rbs/util/rbs_assert.h +1 -12
  85. data/include/rbs/util/rbs_constant_pool.h +3 -3
  86. data/include/rbs/util/rbs_encoding.h +1 -3
  87. data/include/rbs/util/rbs_unescape.h +1 -2
  88. data/lib/rbs/ast/ruby/annotations.rb +119 -0
  89. data/lib/rbs/ast/ruby/comment_block.rb +221 -0
  90. data/lib/rbs/ast/ruby/declarations.rb +86 -0
  91. data/lib/rbs/ast/ruby/helpers/constant_helper.rb +24 -0
  92. data/lib/rbs/ast/ruby/helpers/location_helper.rb +15 -0
  93. data/lib/rbs/ast/ruby/members.rb +213 -0
  94. data/lib/rbs/buffer.rb +104 -24
  95. data/lib/rbs/cli/validate.rb +40 -35
  96. data/lib/rbs/cli.rb +5 -6
  97. data/lib/rbs/collection/config/lockfile_generator.rb +0 -8
  98. data/lib/rbs/collection.rb +0 -1
  99. data/lib/rbs/definition.rb +6 -1
  100. data/lib/rbs/definition_builder/ancestor_builder.rb +65 -62
  101. data/lib/rbs/definition_builder/method_builder.rb +45 -30
  102. data/lib/rbs/definition_builder.rb +44 -9
  103. data/lib/rbs/environment/class_entry.rb +69 -0
  104. data/lib/rbs/environment/module_entry.rb +66 -0
  105. data/lib/rbs/environment.rb +244 -218
  106. data/lib/rbs/environment_loader.rb +8 -2
  107. data/lib/rbs/errors.rb +5 -4
  108. data/lib/rbs/inline_parser/comment_association.rb +117 -0
  109. data/lib/rbs/inline_parser.rb +206 -0
  110. data/lib/rbs/location_aux.rb +35 -3
  111. data/lib/rbs/parser_aux.rb +11 -6
  112. data/lib/rbs/prototype/runtime.rb +2 -2
  113. data/lib/rbs/resolver/constant_resolver.rb +2 -2
  114. data/lib/rbs/resolver/type_name_resolver.rb +38 -124
  115. data/lib/rbs/source.rb +99 -0
  116. data/lib/rbs/subtractor.rb +5 -6
  117. data/lib/rbs/test/type_check.rb +0 -14
  118. data/lib/rbs/types.rb +1 -3
  119. data/lib/rbs/version.rb +1 -1
  120. data/lib/rbs.rb +13 -1
  121. data/lib/rdoc/discover.rb +1 -1
  122. data/lib/rdoc_plugin/parser.rb +1 -1
  123. data/rbs.gemspec +1 -0
  124. data/sig/ancestor_builder.rbs +1 -1
  125. data/sig/ast/ruby/annotations.rbs +110 -0
  126. data/sig/ast/ruby/comment_block.rbs +119 -0
  127. data/sig/ast/ruby/declarations.rbs +60 -0
  128. data/sig/ast/ruby/helpers/constant_helper.rbs +11 -0
  129. data/sig/ast/ruby/helpers/location_helper.rbs +15 -0
  130. data/sig/ast/ruby/members.rbs +72 -0
  131. data/sig/buffer.rbs +63 -5
  132. data/sig/definition.rbs +1 -0
  133. data/sig/definition_builder.rbs +1 -1
  134. data/sig/environment/class_entry.rbs +50 -0
  135. data/sig/environment/module_entry.rbs +50 -0
  136. data/sig/environment.rbs +28 -133
  137. data/sig/errors.rbs +13 -6
  138. data/sig/inline_parser/comment_association.rbs +71 -0
  139. data/sig/inline_parser.rbs +87 -0
  140. data/sig/location.rbs +32 -7
  141. data/sig/manifest.yaml +1 -0
  142. data/sig/method_builder.rbs +7 -4
  143. data/sig/parser.rbs +16 -20
  144. data/sig/resolver/type_name_resolver.rbs +7 -38
  145. data/sig/source.rbs +48 -0
  146. data/sig/types.rbs +1 -4
  147. data/src/ast.c +290 -201
  148. data/src/lexer.c +2813 -2902
  149. data/src/lexer.re +4 -0
  150. data/src/lexstate.c +155 -169
  151. data/src/location.c +40 -40
  152. data/src/parser.c +2665 -2433
  153. data/src/string.c +48 -0
  154. data/src/util/rbs_allocator.c +76 -92
  155. data/src/util/rbs_assert.c +10 -10
  156. data/src/util/rbs_buffer.c +2 -2
  157. data/src/util/rbs_constant_pool.c +15 -13
  158. data/src/util/rbs_encoding.c +4062 -20097
  159. data/src/util/rbs_unescape.c +48 -85
  160. data/stdlib/bigdecimal/0/big_decimal.rbs +82 -100
  161. data/stdlib/bigdecimal-math/0/big_math.rbs +8 -169
  162. data/stdlib/cgi/0/core.rbs +393 -9
  163. data/stdlib/cgi/0/manifest.yaml +0 -1
  164. data/stdlib/coverage/0/coverage.rbs +1 -3
  165. data/stdlib/date/0/date.rbs +59 -67
  166. data/stdlib/date/0/date_time.rbs +1 -1
  167. data/stdlib/delegate/0/delegator.rbs +7 -10
  168. data/stdlib/erb/0/erb.rbs +347 -737
  169. data/stdlib/fileutils/0/fileutils.rbs +13 -18
  170. data/stdlib/forwardable/0/forwardable.rbs +0 -3
  171. data/stdlib/json/0/json.rbs +48 -68
  172. data/stdlib/net-http/0/net-http.rbs +0 -3
  173. data/stdlib/objspace/0/objspace.rbs +4 -9
  174. data/stdlib/open-uri/0/open-uri.rbs +0 -40
  175. data/stdlib/openssl/0/openssl.rbs +228 -331
  176. data/stdlib/optparse/0/optparse.rbs +3 -3
  177. data/stdlib/pathname/0/pathname.rbs +1380 -10
  178. data/stdlib/psych/0/psych.rbs +3 -3
  179. data/stdlib/rdoc/0/rdoc.rbs +1 -1
  180. data/stdlib/resolv/0/resolv.rbs +68 -25
  181. data/stdlib/ripper/0/ripper.rbs +2 -5
  182. data/stdlib/singleton/0/singleton.rbs +0 -3
  183. data/stdlib/socket/0/socket.rbs +1 -13
  184. data/stdlib/socket/0/tcp_socket.rbs +2 -10
  185. data/stdlib/stringio/0/stringio.rbs +85 -1176
  186. data/stdlib/strscan/0/string_scanner.rbs +31 -31
  187. data/stdlib/tempfile/0/tempfile.rbs +3 -3
  188. data/stdlib/time/0/time.rbs +1 -1
  189. data/stdlib/timeout/0/timeout.rbs +7 -63
  190. data/stdlib/tsort/0/cyclic.rbs +0 -3
  191. data/stdlib/uri/0/common.rbs +2 -11
  192. data/stdlib/uri/0/file.rbs +1 -1
  193. data/stdlib/uri/0/generic.rbs +16 -17
  194. data/stdlib/uri/0/rfc2396_parser.rbs +7 -6
  195. data/stdlib/zlib/0/zstream.rbs +0 -1
  196. metadata +39 -12
  197. data/.clang-format +0 -74
  198. data/.clangd +0 -2
  199. data/.github/workflows/c-check.yml +0 -54
  200. data/core/pathname.rbs +0 -1272
  201. data/core/ruby.rbs +0 -53
  202. data/docs/aliases.md +0 -79
  203. data/docs/encoding.md +0 -56
  204. data/ext/rbs_extension/compat.h +0 -10
  205. data/stdlib/cgi-escape/0/escape.rbs +0 -171
data/core/float.rbs CHANGED
@@ -1,193 +1,15 @@
1
- # <!-- rdoc-file=float.rb -->
2
- # A Float object stores a real number using the native architecture's
3
- # double-precision floating-point representation.
4
- #
5
- # ## Float Imprecisions
6
- #
7
- # Some real numbers can be represented precisely as Float objects:
8
- #
9
- # 37.5 # => 37.5
10
- # 98.75 # => 98.75
11
- # 12.3125 # => 12.3125
12
- #
13
- # Others cannot; among these are the transcendental numbers, including:
14
- #
15
- # * Pi, *π*: in mathematics, a number of infinite precision:
16
- # 3.1415926535897932384626433... (to 25 places); in Ruby, it is of limited
17
- # precision (in this case, to 16 decimal places):
18
- #
19
- # Math::PI # => 3.141592653589793
20
- #
21
- # * Euler's number, *e*: in mathematics, a number of infinite precision:
22
- # 2.7182818284590452353602874... (to 25 places); in Ruby, it is of limited
23
- # precision (in this case, to 15 decimal places):
24
- #
25
- # Math::E # => 2.718281828459045
26
- #
27
- # Some floating-point computations in Ruby give precise results:
28
- #
29
- # 1.0/2 # => 0.5
30
- # 100.0/8 # => 12.5
31
- #
32
- # Others do not:
33
- #
34
- # * In mathematics, 2/3 as a decimal number is an infinitely-repeating
35
- # decimal: 0.666... (forever); in Ruby, `2.0/3` is of limited precision (in
36
- # this case, to 16 decimal places):
37
- #
38
- # 2.0/3 # => 0.6666666666666666
39
- #
40
- # * In mathematics, the square root of 2 is an irrational number of infinite
41
- # precision: 1.4142135623730950488016887... (to 25 decimal places); in Ruby,
42
- # it is of limited precision (in this case, to 16 decimal places):
43
- #
44
- # Math.sqrt(2.0) # => 1.4142135623730951
45
- #
46
- # * Even a simple computation can introduce imprecision:
47
- #
48
- # x = 0.1 + 0.2 # => 0.30000000000000004
49
- # y = 0.3 # => 0.3
50
- # x == y # => false
51
- #
52
- # See:
53
- #
54
- # * https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
55
- # * https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#-why-are-rub
56
- # ys-floats-imprecise
57
- # * https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
58
- #
59
- # Note that precise storage and computation of rational numbers is possible
60
- # using Rational objects.
61
- #
62
- # ## Creating a Float
63
- #
64
- # You can create a Float object explicitly with:
65
- #
66
- # * A [floating-point literal](rdoc-ref:syntax/literals.rdoc@Float+Literals).
67
- #
68
- # You can convert certain objects to Floats with:
69
- #
70
- # * Method #Float.
71
- #
72
- # ## What's Here
73
- #
74
- # First, what's elsewhere. Class Float:
75
- #
76
- # * Inherits from [class Numeric](rdoc-ref:Numeric@What-27s+Here) and [class
77
- # Object](rdoc-ref:Object@What-27s+Here).
78
- # * Includes [module Comparable](rdoc-ref:Comparable@What-27s+Here).
79
- #
80
- # Here, class Float provides methods for:
81
- #
82
- # * [Querying](rdoc-ref:Float@Querying)
83
- # * [Comparing](rdoc-ref:Float@Comparing)
84
- # * [Converting](rdoc-ref:Float@Converting)
85
- #
86
- # ### Querying
87
- #
88
- # * #finite?: Returns whether `self` is finite.
89
- # * #hash: Returns the integer hash code for `self`.
90
- # * #infinite?: Returns whether `self` is infinite.
91
- # * #nan?: Returns whether `self` is a NaN (not-a-number).
92
- #
93
- # ### Comparing
94
- #
95
- # * #<: Returns whether `self` is less than the given value.
96
- # * #<=: Returns whether `self` is less than or equal to the given value.
97
- # * #<=>: Returns a number indicating whether `self` is less than, equal to,
98
- # or greater than the given value.
99
- # * #== (aliased as #=== and #eql?): Returns whether `self` is equal to the
100
- # given value.
101
- # * #>: Returns whether `self` is greater than the given value.
102
- # * #>=: Returns whether `self` is greater than or equal to the given value.
103
- #
104
- # ### Converting
105
- #
106
- # * #% (aliased as #modulo): Returns `self` modulo the given value.
107
- # * #*: Returns the product of `self` and the given value.
108
- # * #**: Returns the value of `self` raised to the power of the given value.
109
- # * #+: Returns the sum of `self` and the given value.
110
- # * #-: Returns the difference of `self` and the given value.
111
- # * #/: Returns the quotient of `self` and the given value.
112
- # * #ceil: Returns the smallest number greater than or equal to `self`.
113
- # * #coerce: Returns a 2-element array containing the given value converted to
114
- # a Float and `self`
115
- # * #divmod: Returns a 2-element array containing the quotient and remainder
116
- # results of dividing `self` by the given value.
117
- # * #fdiv: Returns the Float result of dividing `self` by the given value.
118
- # * #floor: Returns the greatest number smaller than or equal to `self`.
119
- # * #next_float: Returns the next-larger representable Float.
120
- # * #prev_float: Returns the next-smaller representable Float.
121
- # * #quo: Returns the quotient from dividing `self` by the given value.
122
- # * #round: Returns `self` rounded to the nearest value, to a given precision.
123
- # * #to_i (aliased as #to_int): Returns `self` truncated to an Integer.
124
- # * #to_s (aliased as #inspect): Returns a string containing the place-value
125
- # representation of `self` in the given radix.
126
- # * #truncate: Returns `self` truncated to a given precision.
127
- #
128
- # <!-- rdoc-file=float.rb -->
129
- # A Float object stores a real number using the native architecture's
130
- # double-precision floating-point representation.
131
- #
132
- # ## Float Imprecisions
133
- #
134
- # Some real numbers can be represented precisely as Float objects:
135
- #
136
- # 37.5 # => 37.5
137
- # 98.75 # => 98.75
138
- # 12.3125 # => 12.3125
139
- #
140
- # Others cannot; among these are the transcendental numbers, including:
141
- #
142
- # * Pi, *π*: in mathematics, a number of infinite precision:
143
- # 3.1415926535897932384626433... (to 25 places); in Ruby, it is of limited
144
- # precision (in this case, to 16 decimal places):
145
- #
146
- # Math::PI # => 3.141592653589793
147
- #
148
- # * Euler's number, *e*: in mathematics, a number of infinite precision:
149
- # 2.7182818284590452353602874... (to 25 places); in Ruby, it is of limited
150
- # precision (in this case, to 15 decimal places):
151
- #
152
- # Math::E # => 2.718281828459045
153
- #
154
- # Some floating-point computations in Ruby give precise results:
155
- #
156
- # 1.0/2 # => 0.5
157
- # 100.0/8 # => 12.5
158
- #
159
- # Others do not:
160
- #
161
- # * In mathematics, 2/3 as a decimal number is an infinitely-repeating
162
- # decimal: 0.666... (forever); in Ruby, `2.0/3` is of limited precision (in
163
- # this case, to 16 decimal places):
164
- #
165
- # 2.0/3 # => 0.6666666666666666
166
- #
167
- # * In mathematics, the square root of 2 is an irrational number of infinite
168
- # precision: 1.4142135623730950488016887... (to 25 decimal places); in Ruby,
169
- # it is of limited precision (in this case, to 16 decimal places):
170
- #
171
- # Math.sqrt(2.0) # => 1.4142135623730951
172
- #
173
- # * Even a simple computation can introduce imprecision:
174
- #
175
- # x = 0.1 + 0.2 # => 0.30000000000000004
176
- # y = 0.3 # => 0.3
177
- # x == y # => false
1
+ # <!-- rdoc-file=numeric.c -->
2
+ # A Float object represents a sometimes-inexact real number using the native
3
+ # architecture's double-precision floating point representation.
178
4
  #
179
- # See:
5
+ # Floating point has a different arithmetic and is an inexact number. So you
6
+ # should know its esoteric system. See following:
180
7
  #
181
8
  # * https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
182
9
  # * https://github.com/rdp/ruby_tutorials_core/wiki/Ruby-Talk-FAQ#-why-are-rub
183
10
  # ys-floats-imprecise
184
11
  # * https://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
185
12
  #
186
- # Note that precise storage and computation of rational numbers is possible
187
- # using Rational objects.
188
- #
189
- # ## Creating a Float
190
- #
191
13
  # You can create a Float object explicitly with:
192
14
  #
193
15
  # * A [floating-point literal](rdoc-ref:syntax/literals.rdoc@Float+Literals).
@@ -257,7 +79,7 @@ class Float < Numeric
257
79
  # rdoc-file=numeric.c
258
80
  # - self % other -> float
259
81
  # -->
260
- # Returns `self` modulo `other` as a Float.
82
+ # Returns `self` modulo `other` as a float.
261
83
  #
262
84
  # For float `f` and real number `r`, these expressions are equivalent:
263
85
  #
@@ -289,7 +111,7 @@ class Float < Numeric
289
111
  # rdoc-file=numeric.c
290
112
  # - self * other -> numeric
291
113
  # -->
292
- # Returns the numeric product of `self` and `other`:
114
+ # Returns a new Float which is the product of `self` and `other`:
293
115
  #
294
116
  # f = 3.14
295
117
  # f * 2 # => 6.28
@@ -302,9 +124,9 @@ class Float < Numeric
302
124
 
303
125
  # <!--
304
126
  # rdoc-file=numeric.c
305
- # - self ** exponent -> numeric
127
+ # - self ** other -> numeric
306
128
  # -->
307
- # Returns `self` raised to the power `exponent`:
129
+ # Raises `self` to the power of `other`:
308
130
  #
309
131
  # f = 3.14
310
132
  # f ** 2 # => 9.8596
@@ -318,20 +140,15 @@ class Float < Numeric
318
140
 
319
141
  # <!--
320
142
  # rdoc-file=numeric.c
321
- # - self + other -> float or complex
143
+ # - self + other -> numeric
322
144
  # -->
323
- # Returns the sum of `self` and `other`; the result may be inexact (see Float):
324
- #
325
- # 3.14 + 0 # => 3.14
326
- # 3.14 + 1 # => 4.140000000000001
327
- # -3.14 + 0 # => -3.14
328
- # -3.14 + 1 # => -2.14
145
+ # Returns a new Float which is the sum of `self` and `other`:
329
146
  #
330
- # 3.14 + -3.14 # => 0.0
331
- # -3.14 + -3.14 # => -6.28
332
- #
333
- # 3.14 + Complex(1, 0) # => (4.140000000000001+0i)
334
- # 3.14 + Rational(1, 1) # => 4.140000000000001
147
+ # f = 3.14
148
+ # f + 1 # => 4.140000000000001
149
+ # f + 1.0 # => 4.140000000000001
150
+ # f + Rational(1, 1) # => 4.140000000000001
151
+ # f + Complex(1, 0) # => (4.140000000000001+0i)
335
152
  #
336
153
  def +: (Complex) -> Complex
337
154
  | (Numeric) -> Float
@@ -342,7 +159,7 @@ class Float < Numeric
342
159
  # rdoc-file=numeric.c
343
160
  # - self - other -> numeric
344
161
  # -->
345
- # Returns the difference of `self` and `other`:
162
+ # Returns a new Float which is the difference of `self` and `other`:
346
163
  #
347
164
  # f = 3.14
348
165
  # f - 1 # => 2.14
@@ -355,13 +172,9 @@ class Float < Numeric
355
172
 
356
173
  # <!--
357
174
  # rdoc-file=numeric.rb
358
- # - -self -> float
175
+ # - -float -> float
359
176
  # -->
360
- # Returns `self`, negated:
361
- #
362
- # -3.14 # => -3.14
363
- # -(-3.14) # => 3.14
364
- # -0.0 # => -0.0
177
+ # Returns `self`, negated.
365
178
  #
366
179
  def -@: () -> Float
367
180
 
@@ -369,7 +182,7 @@ class Float < Numeric
369
182
  # rdoc-file=numeric.c
370
183
  # - self / other -> numeric
371
184
  # -->
372
- # Returns the quotient of `self` and `other`:
185
+ # Returns a new Float which is the result of dividing `self` by `other`:
373
186
  #
374
187
  # f = 3.14
375
188
  # f / 2 # => 1.57
@@ -384,8 +197,7 @@ class Float < Numeric
384
197
  # rdoc-file=numeric.c
385
198
  # - self < other -> true or false
386
199
  # -->
387
- # Returns whether the value of `self` is less than the value of `other`; `other`
388
- # must be numeric, but may not be Complex:
200
+ # Returns `true` if `self` is numerically less than `other`:
389
201
  #
390
202
  # 2.0 < 3 # => true
391
203
  # 2.0 < 3.0 # => true
@@ -400,8 +212,7 @@ class Float < Numeric
400
212
  # rdoc-file=numeric.c
401
213
  # - self <= other -> true or false
402
214
  # -->
403
- # Returns whether the value of `self` is less than or equal to the value of
404
- # `other`; `other` must be numeric, but may not be Complex:
215
+ # Returns `true` if `self` is numerically less than or equal to `other`:
405
216
  #
406
217
  # 2.0 <= 3 # => true
407
218
  # 2.0 <= 3.0 # => true
@@ -415,31 +226,29 @@ class Float < Numeric
415
226
 
416
227
  # <!--
417
228
  # rdoc-file=numeric.c
418
- # - self <=> other -> -1, 0, 1, or nil
229
+ # - self <=> other -> -1, 0, +1, or nil
419
230
  # -->
420
- # Compares `self` and `other`.
421
- #
422
- # Returns:
231
+ # Returns a value that depends on the numeric relation between `self` and
232
+ # `other`:
423
233
  #
424
- # * `-1`, if `self` is less than `other`.
425
- # * `0`, if `self` is equal to `other`.
426
- # * `1`, if `self` is greater than `other`.
234
+ # * -1, if `self` is less than `other`.
235
+ # * 0, if `self` is equal to `other`.
236
+ # * 1, if `self` is greater than `other`.
427
237
  # * `nil`, if the two values are incommensurate.
428
238
  #
429
239
  # Examples:
430
240
  #
431
- # 2.0 <=> 2.1 # => -1
432
241
  # 2.0 <=> 2 # => 0
433
242
  # 2.0 <=> 2.0 # => 0
434
243
  # 2.0 <=> Rational(2, 1) # => 0
435
244
  # 2.0 <=> Complex(2, 0) # => 0
436
245
  # 2.0 <=> 1.9 # => 1
246
+ # 2.0 <=> 2.1 # => -1
437
247
  # 2.0 <=> 'foo' # => nil
438
248
  #
439
- # `Float::NAN <=> Float::NAN` returns an implementation-dependent value.
249
+ # This is the basis for the tests in the Comparable module.
440
250
  #
441
- # Class Float includes module Comparable, each of whose methods uses Float#<=>
442
- # for comparison.
251
+ # `Float::NAN <=> Float::NAN` returns an implementation-dependent value.
443
252
  #
444
253
  def <=>: (Numeric) -> Integer?
445
254
 
@@ -837,7 +646,7 @@ class Float < Numeric
837
646
  alias magnitude abs
838
647
 
839
648
  # <!-- rdoc-file=numeric.c -->
840
- # Returns `self` modulo `other` as a Float.
649
+ # Returns `self` modulo `other` as a float.
841
650
  #
842
651
  # For float `f` and real number `r`, these expressions are equivalent:
843
652
  #
@@ -1285,7 +1094,7 @@ Float::MAX_EXP: Integer
1285
1094
  # Usually defaults to 2.2250738585072014e-308.
1286
1095
  #
1287
1096
  # If the platform supports denormalized numbers, there are numbers between zero
1288
- # and Float::MIN. `0.0.next_float` returns the smallest positive floating point
1097
+ # and Float::MIN. 0.0.next_float returns the smallest positive floating point
1289
1098
  # number including denormalized numbers.
1290
1099
  #
1291
1100
  Float::MIN: Float