diff options
| author | BurdetteLamar <burdettelamar@yahoo.com> | 2025-12-15 21:28:41 +0000 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-12-15 17:28:35 -0500 |
| commit | cfd41cbf0338a28638ed54edb0de13539b159dfb (patch) | |
| tree | 8cbbc6e68d7ffe6b1e2037e1afae3c3e8671dea7 | |
| parent | acbf55f4e6658f94e49f28b4df21ab0c29683c4b (diff) | |
[DOC] Harmonize #-@ methods
| -rw-r--r-- | complex.c | 4 | ||||
| -rw-r--r-- | numeric.c | 2 | ||||
| -rw-r--r-- | numeric.rb | 17 | ||||
| -rw-r--r-- | rational.c | 8 |
4 files changed, 22 insertions, 9 deletions
@@ -799,9 +799,9 @@ rb_complex_imag(VALUE self) /* * call-seq: - * -complex -> new_complex + * -self -> complex * - * Returns the negation of +self+, which is the negation of each of its parts: + * Returns +self+, negated, which is the negation of each of its parts: * * -Complex.rect(1, 2) # => (-1-2i) * -Complex.rect(-1, -2) # => (1+2i) @@ -576,7 +576,7 @@ num_imaginary(VALUE num) * call-seq: * -self -> numeric * - * Unary Minus---Returns the receiver, negated. + * Returns +self+, negated. */ static VALUE diff --git a/numeric.rb b/numeric.rb index 552a3dd687..306561943d 100644 --- a/numeric.rb +++ b/numeric.rb @@ -93,9 +93,14 @@ end class Integer # call-seq: - # -int -> integer + # -self -> integer + # + # Returns +self+, negated: + # + # -1 # => -1 + # -(-1) # => 1 + # -0 # => 0 # - # Returns +self+, negated. def -@ Primitive.attr! :leaf Primitive.cexpr! 'rb_int_uminus(self)' @@ -373,9 +378,13 @@ class Float alias magnitude abs # call-seq: - # -float -> float + # -self -> float + # + # Returns +self+, negated: # - # Returns +self+, negated. + # -3.14 # => -3.14 + # -(-3.14) # => 3.14 + # -0.0 # => -0.0 # def -@ Primitive.attr! :leaf diff --git a/rational.c b/rational.c index f03a98a9ee..05dc3540c0 100644 --- a/rational.c +++ b/rational.c @@ -609,9 +609,13 @@ nurat_denominator(VALUE self) /* * call-seq: - * -rat -> rational + * -self -> rational + * + * Returns +self+, negated: + * + * -(1/3r) # => (-1/3) + * -(-1/3r) # => (1/3) * - * Negates +rat+. */ VALUE rb_rational_uminus(VALUE self) |
