Skip to content

Commit cfd41cb

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
[DOC] Harmonize #-@ methods
1 parent acbf55f commit cfd41cb

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

complex.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,9 @@ rb_complex_imag(VALUE self)
799799

800800
/*
801801
* call-seq:
802-
* -complex -> new_complex
802+
* -self -> complex
803803
*
804-
* Returns the negation of +self+, which is the negation of each of its parts:
804+
* Returns +self+, negated, which is the negation of each of its parts:
805805
*
806806
* -Complex.rect(1, 2) # => (-1-2i)
807807
* -Complex.rect(-1, -2) # => (1+2i)

numeric.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ num_imaginary(VALUE num)
576576
* call-seq:
577577
* -self -> numeric
578578
*
579-
* Unary Minus---Returns the receiver, negated.
579+
* Returns +self+, negated.
580580
*/
581581

582582
static VALUE

numeric.rb

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,14 @@ def +@
9393

9494
class Integer
9595
# call-seq:
96-
# -int -> integer
96+
# -self -> integer
97+
#
98+
# Returns +self+, negated:
99+
#
100+
# -1 # => -1
101+
# -(-1) # => 1
102+
# -0 # => 0
97103
#
98-
# Returns +self+, negated.
99104
def -@
100105
Primitive.attr! :leaf
101106
Primitive.cexpr! 'rb_int_uminus(self)'
@@ -373,9 +378,13 @@ def abs
373378
alias magnitude abs
374379

375380
# call-seq:
376-
# -float -> float
381+
# -self -> float
382+
#
383+
# Returns +self+, negated:
377384
#
378-
# Returns +self+, negated.
385+
# -3.14 # => -3.14
386+
# -(-3.14) # => 3.14
387+
# -0.0 # => -0.0
379388
#
380389
def -@
381390
Primitive.attr! :leaf

rational.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,9 +609,13 @@ nurat_denominator(VALUE self)
609609

610610
/*
611611
* call-seq:
612-
* -rat -> rational
612+
* -self -> rational
613+
*
614+
* Returns +self+, negated:
615+
*
616+
* -(1/3r) # => (-1/3)
617+
* -(-1/3r) # => (1/3)
613618
*
614-
* Negates +rat+.
615619
*/
616620
VALUE
617621
rb_rational_uminus(VALUE self)

0 commit comments

Comments
 (0)