steep 0.16.0 → 0.16.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 (147) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -3
  3. data/CHANGELOG.md +6 -0
  4. data/Rakefile +0 -13
  5. data/bin/setup +0 -2
  6. data/bin/smoke_runner.rb +0 -1
  7. data/exe/steep +0 -1
  8. data/lib/steep/project/file.rb +1 -1
  9. data/lib/steep/project/hover_content.rb +1 -1
  10. data/lib/steep/server/code_worker.rb +1 -1
  11. data/lib/steep/server/signature_worker.rb +4 -4
  12. data/lib/steep/type_construction.rb +10 -16
  13. data/lib/steep/type_inference/constant_env.rb +2 -10
  14. data/lib/steep/type_inference/context.rb +1 -0
  15. data/lib/steep/version.rb +1 -1
  16. data/steep.gemspec +1 -5
  17. metadata +17 -135
  18. data/exe/rbs +0 -3
  19. data/vendor/ruby-signature/.github/workflows/ruby.yml +0 -27
  20. data/vendor/ruby-signature/.gitignore +0 -12
  21. data/vendor/ruby-signature/.rubocop.yml +0 -15
  22. data/vendor/ruby-signature/BSDL +0 -22
  23. data/vendor/ruby-signature/COPYING +0 -56
  24. data/vendor/ruby-signature/Gemfile +0 -6
  25. data/vendor/ruby-signature/README.md +0 -93
  26. data/vendor/ruby-signature/Rakefile +0 -142
  27. data/vendor/ruby-signature/bin/annotate-with-rdoc +0 -157
  28. data/vendor/ruby-signature/bin/console +0 -14
  29. data/vendor/ruby-signature/bin/query-rdoc +0 -103
  30. data/vendor/ruby-signature/bin/setup +0 -10
  31. data/vendor/ruby-signature/bin/sort +0 -89
  32. data/vendor/ruby-signature/bin/test_runner.rb +0 -16
  33. data/vendor/ruby-signature/docs/CONTRIBUTING.md +0 -97
  34. data/vendor/ruby-signature/docs/sigs.md +0 -148
  35. data/vendor/ruby-signature/docs/stdlib.md +0 -152
  36. data/vendor/ruby-signature/docs/syntax.md +0 -528
  37. data/vendor/ruby-signature/exe/rbs +0 -7
  38. data/vendor/ruby-signature/lib/rbs.rb +0 -64
  39. data/vendor/ruby-signature/lib/rbs/ast/annotation.rb +0 -27
  40. data/vendor/ruby-signature/lib/rbs/ast/comment.rb +0 -27
  41. data/vendor/ruby-signature/lib/rbs/ast/declarations.rb +0 -395
  42. data/vendor/ruby-signature/lib/rbs/ast/members.rb +0 -362
  43. data/vendor/ruby-signature/lib/rbs/buffer.rb +0 -50
  44. data/vendor/ruby-signature/lib/rbs/builtin_names.rb +0 -55
  45. data/vendor/ruby-signature/lib/rbs/cli.rb +0 -558
  46. data/vendor/ruby-signature/lib/rbs/constant.rb +0 -26
  47. data/vendor/ruby-signature/lib/rbs/constant_table.rb +0 -150
  48. data/vendor/ruby-signature/lib/rbs/definition.rb +0 -170
  49. data/vendor/ruby-signature/lib/rbs/definition_builder.rb +0 -919
  50. data/vendor/ruby-signature/lib/rbs/environment.rb +0 -281
  51. data/vendor/ruby-signature/lib/rbs/environment_loader.rb +0 -136
  52. data/vendor/ruby-signature/lib/rbs/environment_walker.rb +0 -124
  53. data/vendor/ruby-signature/lib/rbs/errors.rb +0 -187
  54. data/vendor/ruby-signature/lib/rbs/location.rb +0 -102
  55. data/vendor/ruby-signature/lib/rbs/method_type.rb +0 -123
  56. data/vendor/ruby-signature/lib/rbs/namespace.rb +0 -91
  57. data/vendor/ruby-signature/lib/rbs/parser.y +0 -1344
  58. data/vendor/ruby-signature/lib/rbs/prototype/rb.rb +0 -553
  59. data/vendor/ruby-signature/lib/rbs/prototype/rbi.rb +0 -587
  60. data/vendor/ruby-signature/lib/rbs/prototype/runtime.rb +0 -381
  61. data/vendor/ruby-signature/lib/rbs/substitution.rb +0 -46
  62. data/vendor/ruby-signature/lib/rbs/test.rb +0 -26
  63. data/vendor/ruby-signature/lib/rbs/test/errors.rb +0 -61
  64. data/vendor/ruby-signature/lib/rbs/test/hook.rb +0 -294
  65. data/vendor/ruby-signature/lib/rbs/test/setup.rb +0 -58
  66. data/vendor/ruby-signature/lib/rbs/test/spy.rb +0 -325
  67. data/vendor/ruby-signature/lib/rbs/test/test_helper.rb +0 -183
  68. data/vendor/ruby-signature/lib/rbs/test/type_check.rb +0 -254
  69. data/vendor/ruby-signature/lib/rbs/type_name.rb +0 -70
  70. data/vendor/ruby-signature/lib/rbs/types.rb +0 -936
  71. data/vendor/ruby-signature/lib/rbs/variance_calculator.rb +0 -138
  72. data/vendor/ruby-signature/lib/rbs/vendorer.rb +0 -47
  73. data/vendor/ruby-signature/lib/rbs/version.rb +0 -3
  74. data/vendor/ruby-signature/lib/rbs/writer.rb +0 -269
  75. data/vendor/ruby-signature/lib/ruby/signature.rb +0 -7
  76. data/vendor/ruby-signature/rbs.gemspec +0 -46
  77. data/vendor/ruby-signature/stdlib/abbrev/abbrev.rbs +0 -60
  78. data/vendor/ruby-signature/stdlib/base64/base64.rbs +0 -71
  79. data/vendor/ruby-signature/stdlib/benchmark/benchmark.rbs +0 -372
  80. data/vendor/ruby-signature/stdlib/builtin/array.rbs +0 -1997
  81. data/vendor/ruby-signature/stdlib/builtin/basic_object.rbs +0 -280
  82. data/vendor/ruby-signature/stdlib/builtin/binding.rbs +0 -177
  83. data/vendor/ruby-signature/stdlib/builtin/builtin.rbs +0 -45
  84. data/vendor/ruby-signature/stdlib/builtin/class.rbs +0 -145
  85. data/vendor/ruby-signature/stdlib/builtin/comparable.rbs +0 -116
  86. data/vendor/ruby-signature/stdlib/builtin/complex.rbs +0 -400
  87. data/vendor/ruby-signature/stdlib/builtin/constants.rbs +0 -37
  88. data/vendor/ruby-signature/stdlib/builtin/data.rbs +0 -5
  89. data/vendor/ruby-signature/stdlib/builtin/deprecated.rbs +0 -2
  90. data/vendor/ruby-signature/stdlib/builtin/dir.rbs +0 -413
  91. data/vendor/ruby-signature/stdlib/builtin/encoding.rbs +0 -607
  92. data/vendor/ruby-signature/stdlib/builtin/enumerable.rbs +0 -404
  93. data/vendor/ruby-signature/stdlib/builtin/enumerator.rbs +0 -260
  94. data/vendor/ruby-signature/stdlib/builtin/errno.rbs +0 -781
  95. data/vendor/ruby-signature/stdlib/builtin/errors.rbs +0 -582
  96. data/vendor/ruby-signature/stdlib/builtin/exception.rbs +0 -194
  97. data/vendor/ruby-signature/stdlib/builtin/false_class.rbs +0 -40
  98. data/vendor/ruby-signature/stdlib/builtin/fiber.rbs +0 -68
  99. data/vendor/ruby-signature/stdlib/builtin/fiber_error.rbs +0 -12
  100. data/vendor/ruby-signature/stdlib/builtin/file.rbs +0 -1076
  101. data/vendor/ruby-signature/stdlib/builtin/file_test.rbs +0 -59
  102. data/vendor/ruby-signature/stdlib/builtin/float.rbs +0 -696
  103. data/vendor/ruby-signature/stdlib/builtin/gc.rbs +0 -243
  104. data/vendor/ruby-signature/stdlib/builtin/hash.rbs +0 -1029
  105. data/vendor/ruby-signature/stdlib/builtin/integer.rbs +0 -707
  106. data/vendor/ruby-signature/stdlib/builtin/io.rbs +0 -683
  107. data/vendor/ruby-signature/stdlib/builtin/kernel.rbs +0 -576
  108. data/vendor/ruby-signature/stdlib/builtin/marshal.rbs +0 -161
  109. data/vendor/ruby-signature/stdlib/builtin/match_data.rbs +0 -271
  110. data/vendor/ruby-signature/stdlib/builtin/math.rbs +0 -369
  111. data/vendor/ruby-signature/stdlib/builtin/method.rbs +0 -185
  112. data/vendor/ruby-signature/stdlib/builtin/module.rbs +0 -1104
  113. data/vendor/ruby-signature/stdlib/builtin/nil_class.rbs +0 -82
  114. data/vendor/ruby-signature/stdlib/builtin/numeric.rbs +0 -409
  115. data/vendor/ruby-signature/stdlib/builtin/object.rbs +0 -824
  116. data/vendor/ruby-signature/stdlib/builtin/proc.rbs +0 -429
  117. data/vendor/ruby-signature/stdlib/builtin/process.rbs +0 -1227
  118. data/vendor/ruby-signature/stdlib/builtin/random.rbs +0 -267
  119. data/vendor/ruby-signature/stdlib/builtin/range.rbs +0 -226
  120. data/vendor/ruby-signature/stdlib/builtin/rational.rbs +0 -424
  121. data/vendor/ruby-signature/stdlib/builtin/rb_config.rbs +0 -57
  122. data/vendor/ruby-signature/stdlib/builtin/regexp.rbs +0 -1083
  123. data/vendor/ruby-signature/stdlib/builtin/ruby_vm.rbs +0 -14
  124. data/vendor/ruby-signature/stdlib/builtin/signal.rbs +0 -55
  125. data/vendor/ruby-signature/stdlib/builtin/string.rbs +0 -1901
  126. data/vendor/ruby-signature/stdlib/builtin/string_io.rbs +0 -284
  127. data/vendor/ruby-signature/stdlib/builtin/struct.rbs +0 -40
  128. data/vendor/ruby-signature/stdlib/builtin/symbol.rbs +0 -228
  129. data/vendor/ruby-signature/stdlib/builtin/thread.rbs +0 -1108
  130. data/vendor/ruby-signature/stdlib/builtin/thread_group.rbs +0 -23
  131. data/vendor/ruby-signature/stdlib/builtin/time.rbs +0 -1047
  132. data/vendor/ruby-signature/stdlib/builtin/trace_point.rbs +0 -290
  133. data/vendor/ruby-signature/stdlib/builtin/true_class.rbs +0 -46
  134. data/vendor/ruby-signature/stdlib/builtin/unbound_method.rbs +0 -153
  135. data/vendor/ruby-signature/stdlib/builtin/warning.rbs +0 -17
  136. data/vendor/ruby-signature/stdlib/coverage/coverage.rbs +0 -62
  137. data/vendor/ruby-signature/stdlib/csv/csv.rbs +0 -773
  138. data/vendor/ruby-signature/stdlib/erb/erb.rbs +0 -392
  139. data/vendor/ruby-signature/stdlib/find/find.rbs +0 -40
  140. data/vendor/ruby-signature/stdlib/ipaddr/ipaddr.rbs +0 -247
  141. data/vendor/ruby-signature/stdlib/json/json.rbs +0 -335
  142. data/vendor/ruby-signature/stdlib/pathname/pathname.rbs +0 -1093
  143. data/vendor/ruby-signature/stdlib/prime/integer-extension.rbs +0 -23
  144. data/vendor/ruby-signature/stdlib/prime/prime.rbs +0 -188
  145. data/vendor/ruby-signature/stdlib/securerandom/securerandom.rbs +0 -9
  146. data/vendor/ruby-signature/stdlib/set/set.rbs +0 -301
  147. data/vendor/ruby-signature/stdlib/tmpdir/tmpdir.rbs +0 -53
@@ -1,82 +0,0 @@
1
- # The class of the singleton object `nil`.
2
- #
3
- class NilClass
4
- public
5
-
6
- # And---Returns `false`. *obj* is always evaluated as it is the argument to a
7
- # method call---there is no short-circuit evaluation in this case.
8
- #
9
- def &: (untyped obj) -> bool
10
-
11
- # Case Equality -- For class Object, effectively the same as calling `#==`, but
12
- # typically overridden by descendants to provide meaningful semantics in `case`
13
- # statements.
14
- #
15
- def ===: (nil) -> true
16
- | (untyped obj) -> bool
17
-
18
- # Dummy pattern matching -- always returns nil.
19
- #
20
- def =~: (untyped obj) -> nil
21
-
22
- # Exclusive Or---If *obj* is `nil` or `false`, returns `false`; otherwise,
23
- # returns `true`.
24
- #
25
- def ^: (nil) -> false
26
- | (false) -> false
27
- | (untyped obj) -> bool
28
-
29
- # Always returns the string "nil".
30
- #
31
- def inspect: () -> "nil"
32
-
33
- # Only the object *nil* responds `true` to `nil?`.
34
- #
35
- def nil?: () -> bool
36
-
37
- # Returns zero as a rational. The optional argument `eps` is always ignored.
38
- #
39
- def rationalize: (?untyped eps) -> Rational
40
-
41
- # Always returns an empty array.
42
- #
43
- # nil.to_a #=> []
44
- #
45
- def to_a: () -> [ ]
46
-
47
- # Returns zero as a complex.
48
- #
49
- def to_c: () -> Complex
50
-
51
- # Always returns zero.
52
- #
53
- # nil.to_f #=> 0.0
54
- #
55
- def to_f: () -> Float
56
-
57
- # Always returns an empty hash.
58
- #
59
- # nil.to_h #=> {}
60
- #
61
- def to_h: () -> ::Hash[untyped, untyped]
62
-
63
- # Always returns zero.
64
- #
65
- # nil.to_i #=> 0
66
- #
67
- def to_i: () -> 0
68
-
69
- # Returns zero as a rational.
70
- #
71
- def to_r: () -> Rational
72
-
73
- # Always returns the empty string.
74
- #
75
- def to_s: () -> ""
76
-
77
- # Or---Returns `false` if *obj* is `nil` or `false`; `true` otherwise.
78
- #
79
- def |: (nil) -> false
80
- | (false) -> false
81
- | (untyped obj) -> bool
82
- end
@@ -1,409 +0,0 @@
1
- # Numeric is the class from which all higher-level numeric classes should
2
- # inherit.
3
- #
4
- # Numeric allows instantiation of heap-allocated objects. Other core numeric
5
- # classes such as Integer are implemented as immediates, which means that each
6
- # Integer is a single immutable object which is always passed by value.
7
- #
8
- # a = 1
9
- # 1.object_id == a.object_id #=> true
10
- #
11
- # There can only ever be one instance of the integer `1`, for example. Ruby
12
- # ensures this by preventing instantiation. If duplication is attempted, the
13
- # same instance is returned.
14
- #
15
- # Integer.new(1) #=> NoMethodError: undefined method `new' for Integer:Class
16
- # 1.dup #=> 1
17
- # 1.object_id == 1.dup.object_id #=> true
18
- #
19
- # For this reason, Numeric should be used when defining other numeric classes.
20
- #
21
- # Classes which inherit from Numeric must implement `coerce`, which returns a
22
- # two-member Array containing an object that has been coerced into an instance
23
- # of the new class and `self` (see #coerce).
24
- #
25
- # Inheriting classes should also implement arithmetic operator methods (`+`,
26
- # `-`, `*` and `/`) and the `<=>` operator (see Comparable). These methods may
27
- # rely on `coerce` to ensure interoperability with instances of other numeric
28
- # classes.
29
- #
30
- # class Tally < Numeric
31
- # def initialize(string)
32
- # @string = string
33
- # end
34
- #
35
- # def to_s
36
- # @string
37
- # end
38
- #
39
- # def to_i
40
- # @string.size
41
- # end
42
- #
43
- # def coerce(other)
44
- # [self.class.new('|' * other.to_i), self]
45
- # end
46
- #
47
- # def <=>(other)
48
- # to_i <=> other.to_i
49
- # end
50
- #
51
- # def +(other)
52
- # self.class.new('|' * (to_i + other.to_i))
53
- # end
54
- #
55
- # def -(other)
56
- # self.class.new('|' * (to_i - other.to_i))
57
- # end
58
- #
59
- # def *(other)
60
- # self.class.new('|' * (to_i * other.to_i))
61
- # end
62
- #
63
- # def /(other)
64
- # self.class.new('|' * (to_i / other.to_i))
65
- # end
66
- # end
67
- #
68
- # tally = Tally.new('||')
69
- # puts tally * 2 #=> "||||"
70
- # puts tally > 1 #=> true
71
- #
72
- class Numeric
73
- include Comparable
74
-
75
- public
76
-
77
- # `x.modulo(y)` means `x-y*(x/y).floor`.
78
- #
79
- # Equivalent to `num.divmod(numeric)[1]`.
80
- #
81
- # See Numeric#divmod.
82
- #
83
- def %: (Numeric) -> Numeric
84
-
85
- # Unary Plus---Returns the receiver.
86
- #
87
- def +@: () -> Numeric
88
-
89
- # Unary Minus---Returns the receiver, negated.
90
- #
91
- def -@: () -> Numeric
92
-
93
- # Returns zero if `number` equals `other`, otherwise returns `nil`.
94
- #
95
- def <=>: (Numeric other) -> Integer
96
-
97
- # Returns the absolute value of `num`.
98
- #
99
- # 12.abs #=> 12
100
- # (-34.56).abs #=> 34.56
101
- # -34.56.abs #=> 34.56
102
- #
103
- # Numeric#magnitude is an alias for Numeric#abs.
104
- #
105
- def abs: () -> Numeric
106
-
107
- # Returns square of self.
108
- #
109
- def abs2: () -> Numeric
110
-
111
- # Returns 0 if the value is positive, pi otherwise.
112
- #
113
- def angle: () -> Numeric
114
-
115
- # Returns 0 if the value is positive, pi otherwise.
116
- #
117
- alias arg angle
118
-
119
- # Returns the smallest number greater than or equal to `num` with a precision of
120
- # `ndigits` decimal digits (default: 0).
121
- #
122
- # Numeric implements this by converting its value to a Float and invoking
123
- # Float#ceil.
124
- #
125
- def ceil: () -> Integer
126
- | (Integer digits) -> (Integer | Numeric)
127
-
128
- # If `numeric` is the same type as `num`, returns an array `[numeric, num]`.
129
- # Otherwise, returns an array with both `numeric` and `num` represented as Float
130
- # objects.
131
- #
132
- # This coercion mechanism is used by Ruby to handle mixed-type numeric
133
- # operations: it is intended to find a compatible common type between the two
134
- # operands of the operator.
135
- #
136
- # 1.coerce(2.5) #=> [2.5, 1.0]
137
- # 1.2.coerce(3) #=> [3.0, 1.2]
138
- # 1.coerce(2) #=> [2, 1]
139
- #
140
- def coerce: (Numeric) -> [ Numeric, Numeric ]
141
-
142
- # Returns self.
143
- #
144
- def conj: () -> Numeric
145
-
146
- # Returns self.
147
- #
148
- def conjugate: () -> Numeric
149
-
150
- # Returns the denominator (always positive).
151
- #
152
- def denominator: () -> Integer
153
-
154
- # Uses `/` to perform division, then converts the result to an integer. Numeric
155
- # does not define the `/` operator; this is left to subclasses.
156
- #
157
- # Equivalent to `num.divmod(numeric)[0]`.
158
- #
159
- # See Numeric#divmod.
160
- #
161
- def div: (Numeric) -> Integer
162
-
163
- # Returns an array containing the quotient and modulus obtained by dividing
164
- # `num` by `numeric`.
165
- #
166
- # If `q, r = x.divmod(y)`, then
167
- #
168
- # q = floor(x/y)
169
- # x = q*y + r
170
- #
171
- # The quotient is rounded toward negative infinity, as shown in the following
172
- # table:
173
- #
174
- # a | b | a.divmod(b) | a/b | a.modulo(b) | a.remainder(b)
175
- # ------+-----+---------------+---------+-------------+---------------
176
- # 13 | 4 | 3, 1 | 3 | 1 | 1
177
- # ------+-----+---------------+---------+-------------+---------------
178
- # 13 | -4 | -4, -3 | -4 | -3 | 1
179
- # ------+-----+---------------+---------+-------------+---------------
180
- # -13 | 4 | -4, 3 | -4 | 3 | -1
181
- # ------+-----+---------------+---------+-------------+---------------
182
- # -13 | -4 | 3, -1 | 3 | -1 | -1
183
- # ------+-----+---------------+---------+-------------+---------------
184
- # 11.5 | 4 | 2, 3.5 | 2.875 | 3.5 | 3.5
185
- # ------+-----+---------------+---------+-------------+---------------
186
- # 11.5 | -4 | -3, -0.5 | -2.875 | -0.5 | 3.5
187
- # ------+-----+---------------+---------+-------------+---------------
188
- # -11.5 | 4 | -3, 0.5 | -2.875 | 0.5 | -3.5
189
- # ------+-----+---------------+---------+-------------+---------------
190
- # -11.5 | -4 | 2, -3.5 | 2.875 | -3.5 | -3.5
191
- #
192
- # Examples
193
- #
194
- # 11.divmod(3) #=> [3, 2]
195
- # 11.divmod(-3) #=> [-4, -1]
196
- # 11.divmod(3.5) #=> [3, 0.5]
197
- # (-11).divmod(3.5) #=> [-4, 3.0]
198
- # 11.5.divmod(3.5) #=> [3, 1.0]
199
- #
200
- def divmod: (Numeric) -> [ Numeric, Numeric ]
201
-
202
- # Returns `true` if `num` and `numeric` are the same type and have equal values.
203
- # Contrast this with Numeric#==, which performs type conversions.
204
- #
205
- # 1 == 1.0 #=> true
206
- # 1.eql?(1.0) #=> false
207
- # 1.0.eql?(1.0) #=> true
208
- #
209
- def eql?: (untyped) -> bool
210
-
211
- # Returns float division.
212
- #
213
- def fdiv: (Numeric) -> Numeric
214
-
215
- # Returns `true` if `num` is a finite number, otherwise returns `false`.
216
- #
217
- def finite?: () -> bool
218
-
219
- # Returns the largest number less than or equal to `num` with a precision of
220
- # `ndigits` decimal digits (default: 0).
221
- #
222
- # Numeric implements this by converting its value to a Float and invoking
223
- # Float#floor.
224
- #
225
- def floor: () -> Integer
226
- | (Integer digits) -> Numeric
227
-
228
- # Returns the corresponding imaginary number. Not available for complex numbers.
229
- #
230
- # -42.i #=> (0-42i)
231
- # 2.0.i #=> (0+2.0i)
232
- #
233
- def i: () -> Complex
234
-
235
- # Returns zero.
236
- #
237
- def imag: () -> Numeric
238
-
239
- # Returns zero.
240
- #
241
- def imaginary: () -> Numeric
242
-
243
- # Returns `nil`, -1, or 1 depending on whether the value is finite, `-Infinity`,
244
- # or `+Infinity`.
245
- #
246
- def infinite?: () -> Integer?
247
-
248
- # Returns `true` if `num` is an Integer.
249
- #
250
- # 1.0.integer? #=> false
251
- # 1.integer? #=> true
252
- #
253
- def integer?: () -> bool
254
-
255
- # Returns the absolute value of `num`.
256
- #
257
- # 12.abs #=> 12
258
- # (-34.56).abs #=> 34.56
259
- # -34.56.abs #=> 34.56
260
- #
261
- # Numeric#magnitude is an alias for Numeric#abs.
262
- #
263
- alias magnitude abs
264
-
265
- # `x.modulo(y)` means `x-y*(x/y).floor`.
266
- #
267
- # Equivalent to `num.divmod(numeric)[1]`.
268
- #
269
- # See Numeric#divmod.
270
- #
271
- def modulo: (Numeric) -> Numeric
272
-
273
- # Returns `true` if `num` is less than 0.
274
- #
275
- def negative?: () -> bool
276
-
277
- # Returns `self` if `num` is not zero, `nil` otherwise.
278
- #
279
- # This behavior is useful when chaining comparisons:
280
- #
281
- # a = %w( z Bb bB bb BB a aA Aa AA A )
282
- # b = a.sort {|a,b| (a.downcase <=> b.downcase).nonzero? || a <=> b }
283
- # b #=> ["A", "a", "AA", "Aa", "aA", "BB", "Bb", "bB", "bb", "z"]
284
- #
285
- def nonzero?: () -> self?
286
-
287
- # Returns the numerator.
288
- #
289
- def numerator: () -> Numeric
290
-
291
- # Returns 0 if the value is positive, pi otherwise.
292
- #
293
- alias phase angle
294
-
295
- # Returns an array; [num.abs, num.arg].
296
- #
297
- def polar: () -> [ Numeric, Numeric ]
298
-
299
- # Returns `true` if `num` is greater than 0.
300
- #
301
- def positive?: () -> bool
302
-
303
- # Returns the most exact division (rational for integers, float for floats).
304
- #
305
- def quo: (Numeric) -> Numeric
306
-
307
- # Returns self.
308
- #
309
- def real: () -> Numeric
310
-
311
- # Returns `true` if `num` is a real number (i.e. not Complex).
312
- #
313
- def real?: () -> bool
314
-
315
- # Returns an array; [num, 0].
316
- #
317
- def rect: () -> [ Numeric, Numeric ]
318
-
319
- # Returns an array; [num, 0].
320
- #
321
- alias rectangular rect
322
-
323
- # `x.remainder(y)` means `x-y*(x/y).truncate`.
324
- #
325
- # See Numeric#divmod.
326
- #
327
- def remainder: (Numeric) -> Numeric
328
-
329
- # Returns `num` rounded to the nearest value with a precision of `ndigits`
330
- # decimal digits (default: 0).
331
- #
332
- # Numeric implements this by converting its value to a Float and invoking
333
- # Float#round.
334
- #
335
- def round: () -> Integer
336
- | (Integer digits) -> Numeric
337
-
338
- # Invokes the given block with the sequence of numbers starting at `num`,
339
- # incremented by `step` (defaulted to `1`) on each call.
340
- #
341
- # The loop finishes when the value to be passed to the block is greater than
342
- # `limit` (if `step` is positive) or less than `limit` (if `step` is negative),
343
- # where `limit` is defaulted to infinity.
344
- #
345
- # In the recommended keyword argument style, either or both of `step` and
346
- # `limit` (default infinity) can be omitted. In the fixed position argument
347
- # style, zero as a step (i.e. `num.step(limit, 0)`) is not allowed for
348
- # historical compatibility reasons.
349
- #
350
- # If all the arguments are integers, the loop operates using an integer counter.
351
- #
352
- # If any of the arguments are floating point numbers, all are converted to
353
- # floats, and the loop is executed *floor(n + n*Float::EPSILON) + 1* times,
354
- # where *n = (limit - num)/step*.
355
- #
356
- # Otherwise, the loop starts at `num`, uses either the less-than (`<`) or
357
- # greater-than (`>`) operator to compare the counter against `limit`, and
358
- # increments itself using the `+` operator.
359
- #
360
- # If no block is given, an Enumerator is returned instead. Especially, the
361
- # enumerator is an Enumerator::ArithmeticSequence if both `limit` and `step` are
362
- # kind of Numeric or `nil`.
363
- #
364
- # For example:
365
- #
366
- # p 1.step.take(4)
367
- # p 10.step(by: -1).take(4)
368
- # 3.step(to: 5) {|i| print i, " " }
369
- # 1.step(10, 2) {|i| print i, " " }
370
- # Math::E.step(to: Math::PI, by: 0.2) {|f| print f, " " }
371
- #
372
- # Will produce:
373
- #
374
- # [1, 2, 3, 4]
375
- # [10, 9, 8, 7]
376
- # 3 4 5
377
- # 1 3 5 7 9
378
- # 2.718281828459045 2.9182818284590453 3.118281828459045
379
- #
380
- def step: (?Numeric limit, ?Numeric step) { (Numeric) -> void } -> self
381
- | (?Numeric limit, ?Numeric step) -> Enumerator[Numeric, self]
382
- | (?by: Numeric, ?to: Numeric) { (Numeric) -> void } -> self
383
- | (?by: Numeric, ?to: Numeric) -> Enumerator[Numeric, self]
384
-
385
- # Returns the value as a complex.
386
- #
387
- def to_c: () -> Complex
388
-
389
- # Invokes the child class's `to_i` method to convert `num` to an integer.
390
- #
391
- # 1.0.class #=> Float
392
- # 1.0.to_int.class #=> Integer
393
- # 1.0.to_i.class #=> Integer
394
- #
395
- def to_int: () -> Integer
396
-
397
- # Returns `num` truncated (toward zero) to a precision of `ndigits` decimal
398
- # digits (default: 0).
399
- #
400
- # Numeric implements this by converting its value to a Float and invoking
401
- # Float#truncate.
402
- #
403
- def truncate: () -> Integer
404
- | (Integer ndigits) -> (Integer | Numeric)
405
-
406
- # Returns `true` if `num` has a zero value.
407
- #
408
- def zero?: () -> bool
409
- end