[前][次][番号順一覧][スレッド一覧]

ruby-changes:69872

From: Burdette <ko1@a...>
Date: Tue, 23 Nov 2021 10:04:43 +0900 (JST)
Subject: [ruby-changes:69872] da832d6c2a (master): What's Here section for Integer (#5155)

https://git.ruby-lang.org/ruby.git/commit/?id=da832d6c2a

From da832d6c2a695cbc8f8893e9cac145719b045a71 Mon Sep 17 00:00:00 2001
From: Burdette Lamar <BurdetteLamar@Y...>
Date: Mon, 22 Nov 2021 19:04:25 -0600
Subject: What's Here section for Integer (#5155)

* What's Here section for Integer
---
 numeric.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 83 insertions(+), 4 deletions(-)

diff --git a/numeric.c b/numeric.c
index a894d5179c3..d9431ea67d2 100644
--- a/numeric.c
+++ b/numeric.c
@@ -3418,10 +3418,89 @@ rb_num2ull(VALUE val) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3418
 
 /********************************************************************
  *
- * Document-class: Integer
+ *  Document-class: Integer
  *
- *  Holds Integer values.  You cannot add a singleton method to an
- *  Integer object, any attempt to do so will raise a TypeError.
+ *  An \Integer object represents an integer value.
+ *
+ *  An attempt to add a singleton method to an instance of this class
+ *  causes an exception to be raised.
+ *
+ * == What's Here
+ *
+ * First, what's elsewhere. \Class \Integer:
+ *
+ * - Inherits from {class Numeric}[Numeric.html#class-Numeric-label-What-27s+Here].
+ *
+ * Here, class \Integer provides methods for:
+ *
+ * - {Querying}[#class-Integer-label-Querying]
+ * - {Comparing}[#class-Integer-label-Comparing]
+ * - {Converting}[#class-Integer-label-Converting]
+ * - {Other}[#class-Integer-label-Other]
+ *
+ * === Querying
+ *
+ * - #allbits?:: Returns whether all bits in +self+ are set.
+ * - #anybits?:: Returns whether any bits in +self+ are set.
+ * - #nobits?:: Returns whether no bits in +self+ are set.
+ *
+ * === Comparing
+ *
+ * - {<}[#method-i-3C]:: Returns whether +self+ is less than the given value.
+ * - {<=}[#method-i-3C-3D]:: Returns whether +self+ is less than
+ *                           or equal to the given value.
+ * - {<=>}[#method-i-3C-3D-3E]:: Returns a number indicating whether +self+ is less than,
+ *                               equal to, or greater than the given value.
+ * - {==}[#method-i-3D-3D] (aliased as #===):: Returns whether +self+ is
+ *                                             equal to the given value.
+ * - {>}[#method-i-3E]:: Returns whether +self+ is greater than the given value.
+ * - {>=}[#method-i-3E-3D]:: Returns whether +self+ is greater than
+ *                           or equal to the given value.
+ *
+ * === Converting
+ *
+ * - ::sqrt:: Returns the integer square root of the given value.
+ * - ::try_convert:: Returns the given value converted to an \Integer.
+ * - #% (aliased as #modulo):: Returns +self+ modulo the given value.
+ * - {&}[#method-i-26]:: Returns the bitwise AND of +self+ and the given value.
+ * - #*:: Returns the product of +self+ and the given value.
+ * - {**}[#method-i-2A-2A]:: Returns the value of +self+ raised to the power of the given value.
+ * - #+:: Returns the sum of +self+ and the given value.
+ * - #-:: Returns the difference of +self+ and the given value.
+ * - {/}[#method-i-2F]:: Returns the quotient of +self+ and the given value.
+ * - #<<:: Returns the value of +self+ after a leftward bit-shift.
+ * - #>>:: Returns the value of +self+ after a rightward bit-shift.
+ * - #[]:: Returns a slice of bits from +self+.
+ * - {^}[#method-i-5E]:: Returns the bitwise EXCLUSIVE OR of +self+ and the given value.
+ * - #ceil:: Returns the smallest number greater than or equal to +self+.
+ * - #chr:: Returns a 1-character string containing the character
+ *          represented by the value of +self+.
+ * - #digits:: Returns an array of integers representing the base-radix digits
+ *             of +self+.
+ * - #div:: Returns the integer result of dividing +self+ by the given value.
+ * - #divmod:: Returns a 2-element array containing the quotient and remainder
+ *             results of dividing +self+ by the given value.
+ * - #fdiv:: Returns the Float result of dividing +self+ by the given value.
+ * - #floor:: Returns the greatest number smaller than or equal to +self+.
+ * - #pow:: Returns the modular exponentiation of +self+.
+ * - #pred:: Returns the integer predecessor of +self+.
+ * - #remainder:: Returns the remainder after dividing +self+ by the given value.
+ * - #round:: Returns +self+ rounded to the nearest value with the given precision.
+ * - #succ (aliased as #next):: Returns the integer successor of +self+.
+ * - #to_f:: Returns +self+ converted to a Float.
+ * - #to_s (aliased as #inspect):: Returns a string containing the place-value
+ *                                 representation of +self+ in the given radix.
+ * - #truncate:: Returns +self+ truncated to the given precision.
+ * - {/}[#method-i-7C]:: Returns the bitwise OR of +self+ and the given value.
+ *
+ * === Other
+ *
+ * - #downto:: Calls the given block with each integer value from +self+
+ *             down to the given value.
+ * - #times:: Calls the given block +self+ times with each integer
+ *            in <tt>(0..self-1)</tt>.
+ * - #upto:: Calls the given block with each integer value from +self+
+ *           up to the given value.
  *
  */
 
@@ -5978,7 +6057,7 @@ int_s_try_convert(VALUE self, VALUE num) https://github.com/ruby/ruby/blob/trunk/numeric.c#L6057
  * - {<=>}[#method-i-3C-3D-3E]:: Returns:
  *   - -1 if  +self+ is less than the given value.
  *   - 0 if +self+ is equal to the given value.
- *   - 1 if +self is greater than the given value.
+ *   - 1 if +self+ is greater than the given value.
  *   - +nil+ if +self+ and the given value are not comparable.
  * - #eql?:: Returns whether +self+ and the given value have the same value and type.
  *
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]