Skip to content

Commit 7cddc9f

Browse files
committed
Remove undocumented method #abs2
1 parent 6d3ed75 commit 7cddc9f

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

core/float.rbs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,6 @@ class Float < Numeric
324324
#
325325
def abs: () -> Float
326326

327-
def abs2: () -> Float
328-
329327
# <!-- rdoc-file=complex.c -->
330328
# Returns 0 if `self` is positive, Math::PI otherwise.
331329
#

core/integer.rbs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,6 @@ class Integer < Numeric
513513
#
514514
def abs: () -> Integer
515515

516-
def abs2: () -> Integer
517-
518516
# <!--
519517
# rdoc-file=numeric.c
520518
# - allbits?(mask) -> true or false

core/numeric.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class Numeric
244244
# -->
245245
# Returns the square of `self`.
246246
#
247-
def abs2: () -> Numeric
247+
def abs2: () -> self
248248

249249
# <!-- rdoc-file=complex.c -->
250250
# Returns zero if `self` is positive, Math::PI otherwise.

core/rational.rbs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ class Rational < Numeric
186186
#
187187
def abs: () -> Rational
188188

189-
def abs2: () -> Rational
190-
191189
# <!--
192190
# rdoc-file=rational.c
193191
# - rat.ceil([ndigits]) -> integer or rational

test/stdlib/Complex_test.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,9 @@ def test_real
143143
def test_real?
144144
assert_send_type '() -> false', Complex(1, 2), :real?
145145
end
146+
147+
def test_abs2
148+
assert_send_type '() -> Integer', Complex(1, 2), :abs2
149+
assert_send_type '() -> Float', Complex.polar(2, 2), :abs2
150+
end
146151
end

test/stdlib/Numeric_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@ def test_angle
2727
assert_send_type '() -> Float', -1, :angle
2828
assert_send_type '() -> Float', Float::NAN, :angle
2929
end
30+
31+
def test_abs2
32+
assert_send_type '() -> Integer', 1, :abs2
33+
assert_send_type '() -> Float', 1.0, :abs2
34+
assert_send_type '() -> Rational', 1r, :abs2
35+
end
3036
end

0 commit comments

Comments
 (0)