[DOC] Simplify operator method references

This commit is contained in:
Nobuyoshi Nakada 2022-02-11 10:30:28 +09:00
parent e6b537e605
commit 50c972a1ae
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
10 changed files with 78 additions and 85 deletions

17
array.c
View File

@ -5001,7 +5001,7 @@ recursive_eql(VALUE ary1, VALUE ary2, int recur)
* *
* Otherwise, returns +false+. * Otherwise, returns +false+.
* *
* This method is different from method {Array#==}[#method-i-3D-3D], * This method is different from method Array#==,
* which compares using method <tt>Object#==</tt>. * which compares using method <tt>Object#==</tt>.
*/ */
@ -8119,10 +8119,11 @@ rb_ary_deconstruct(VALUE ary)
* #hash:: Returns the integer hash code. * #hash:: Returns the integer hash code.
* *
* === Methods for Comparing * === Methods for Comparing
* {#<=>}[#method-i-3C-3D-3E]:: Returns -1, 0, or 1
* as +self+ is less than, equal to, or greater than a given object. * #<=>:: Returns -1, 0, or 1 as +self+ is less than, equal to, or greater than a given
* {#==}[#method-i-3D-3D]:: Returns whether each element in +self+ is <tt>==</tt> to the * object.
* corresponding element in a given object. * #==:: Returns whether each element in +self+ is <tt>==</tt> to the corresponding element
* in a given object.
* #eql?:: Returns whether each element in +self+ is <tt>eql?</tt> to the corresponding * #eql?:: Returns whether each element in +self+ is <tt>eql?</tt> to the corresponding
* element in a given object. * element in a given object.
@ -8202,13 +8203,13 @@ rb_ary_deconstruct(VALUE ary)
* *
* === Methods for Combining * === Methods for Combining
* *
* {#&}[#method-i-26]:: Returns an array containing elements found both in +self+ and a given array. * #&:: Returns an array containing elements found both in +self+ and a given array.
* #intersection:: Returns an array containing elements found both in +self+ * #intersection:: Returns an array containing elements found both in +self+
* and in each given array. * and in each given array.
* #+:: Returns an array containing all elements of +self+ followed by all elements of a given array. * #+:: Returns an array containing all elements of +self+ followed by all elements of a given array.
* #-:: Returns an array containiing all elements of +self+ that are not found in a given array. * #-:: Returns an array containiing all elements of +self+ that are not found in a given array.
* {#|}[#method-i-7C]:: Returns an array containing all elements of +self+ and all elements of a given array, * #|:: Returns an array containing all elements of +self+ and all elements of a given array,
* duplicates removed. * duplicates removed.
* #union:: Returns an array containing all elements of +self+ and all elements of given arrays, * #union:: Returns an array containing all elements of +self+ and all elements of given arrays,
* duplicates removed. * duplicates removed.
* #difference:: Returns an array containing all elements of +self+ that are not found * #difference:: Returns an array containing all elements of +self+ that are not found

View File

@ -288,13 +288,11 @@ cmp_clamp(int argc, VALUE *argv, VALUE x)
* *
* \Module \Comparable provides these methods, all of which use method <tt><=></tt>: * \Module \Comparable provides these methods, all of which use method <tt><=></tt>:
* *
* - {<}[#method-i-3C]:: Returns whether +self+ is less than the given object. * - #<:: Returns whether +self+ is less than the given object.
* - {<=}[#method-i-3C-3D]:: Returns whether +self+ is less than or equal to * - #<=:: Returns whether +self+ is less than or equal to the given object.
* the given object. * - #==:: Returns whether +self+ is equal to the given object.
* - {==}[#method-i-3D-3D]:: Returns whether +self+ is equal to the given object. * - #>:: Returns whether +self+ is greater than or equal to the given object.
* - {>}[#method-i-3E]:: Returns whether +self+ is greater than or equal to * - #>=:: Returns whether +self+ is greater than the given object.
* the given object.
* - {>=}[#method-i-3E-3D]:: Returns whether +self+ is greater than the given object.
* - #between? Returns +true+ if +self+ is between two given objects. * - #between? Returns +true+ if +self+ is between two given objects.
* - #clamp:: For given objects +min+ and +max+, or range <tt>(min..max)</tt>, returns: * - #clamp:: For given objects +min+ and +max+, or range <tt>(min..max)</tt>, returns:
* - +min+ if <tt>(self <=> min) < 0</tt>. * - +min+ if <tt>(self <=> min) < 0</tt>.

10
hash.c
View File

@ -7063,11 +7063,11 @@ static const rb_data_type_t env_data_type = {
* *
* ==== Methods for Comparing * ==== Methods for Comparing
* *
* {#<}[#method-i-3C]:: Returns whether +self+ is a proper subset of a given object. * #<:: Returns whether +self+ is a proper subset of a given object.
* {#<=}[#method-i-3C-3D]:: Returns whether +self+ is a subset of a given object. * #<=:: Returns whether +self+ is a subset of a given object.
* {#==}[#method-i-3D-3D]:: Returns whether a given object is equal to +self+. * #==:: Returns whether a given object is equal to +self+.
* {#>}[#method-i-3E]:: Returns whether +self+ is a proper superset of a given object * #>:: Returns whether +self+ is a proper superset of a given object
* {#>=}[#method-i-3E-3D]:: Returns whether +self+ is a proper superset of a given object. * #>=:: Returns whether +self+ is a proper superset of a given object.
* *
* ==== Methods for Fetching * ==== Methods for Fetching
* *

2
io.c
View File

@ -14432,7 +14432,7 @@ set_LAST_READ_LINE(VALUE val, ID _x, VALUE *_y)
* - ::binwrite:: Writes the given string to the file at the given filepath, * - ::binwrite:: Writes the given string to the file at the given filepath,
* in binary mode. * in binary mode.
* - ::write:: Writes the given string to +self+. * - ::write:: Writes the given string to +self+.
* - {::<<}[#method-i-3C-3C]:: Appends the given string to +self+. * - ::<<:: Appends the given string to +self+.
* - #print:: Prints last read line or given objects to +self+. * - #print:: Prints last read line or given objects to +self+.
* - #printf:: Writes to +self+ based on the given format string and objects. * - #printf:: Writes to +self+ based on the given format string and objects.
* - #putc:: Writes a character to +self+. * - #putc:: Writes a character to +self+.

View File

@ -975,25 +975,24 @@ num_negative_p(VALUE num)
* *
* === Comparing * === Comparing
* *
* - {<}[#method-i-3C]:: Returns whether +self+ is less than the given value. * - #<:: Returns whether +self+ is less than the given value.
* - {<=}[#method-i-3C-3D]:: Returns whether +self+ is less than * - #<=:: Returns whether +self+ is less than or equal to the given value.
* or equal to the given value. * - #<=>:: Returns a number indicating whether +self+ is less than, equal
* - {<=>}[#method-i-3C-3D-3E]:: Returns a number indicating whether +self+ is less than, * to, or greater than the given value.
* equal to, or greater than the given value. * - #== (aliased as #=== and #eql?):: Returns whether +self+ is equal to
* - {==}[#method-i-3D-3D] (aliased as #=== and #eql>):: Returns whether +self+ is * the given value.
* equal to the given value. * - #>:: Returns whether +self+ is greater than the given value.
* - {>}[#method-i-3E]:: Returns whether +self+ is greater than the given value. * - #>=:: Returns whether +self+ is greater than or equal to the given
* - {>=}[#method-i-3E-3D]:: Returns whether +self+ is greater than * value.
* or equal to the given value.
* *
* === Converting * === Converting
* *
* - #% (aliased as #modulo):: Returns +self+ modulo the given value. * - #% (aliased as #modulo):: Returns +self+ modulo the given value.
* - #*:: Returns the product 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 value of +self+ raised to the power of the given value.
* - #+:: Returns the sum of +self+ and the given value. * - #+:: Returns the sum of +self+ and the given value.
* - #-:: Returns the difference 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 quotient of +self+ and the given value.
* - #ceil:: Returns the smallest number greater than or equal to +self+. * - #ceil:: Returns the smallest number greater than or equal to +self+.
* - #coerce:: Returns a 2-element array containing the given value converted to a \Float * - #coerce:: Returns a 2-element array containing the given value converted to a \Float
and +self+ and +self+
@ -3512,32 +3511,31 @@ rb_num2ull(VALUE val)
* *
* === Comparing * === Comparing
* *
* - {<}[#method-i-3C]:: Returns whether +self+ is less than the given value. * - #<:: Returns whether +self+ is less than the given value.
* - {<=}[#method-i-3C-3D]:: Returns whether +self+ is less than * - #<=:: Returns whether +self+ is less than or equal to the given value.
* or equal to the given value. * - #<=>:: Returns a number indicating whether +self+ is less than, equal
* - {<=>}[#method-i-3C-3D-3E]:: Returns a number indicating whether +self+ is less than, * to, or greater than the given value.
* equal to, or greater than the given value. * - #== (aliased as #===):: Returns whether +self+ is equal to the given
* - {==}[#method-i-3D-3D] (aliased as #===):: Returns whether +self+ is * value.
* equal to the given value. * - #>:: Returns whether +self+ is greater than the given value.
* - {>}[#method-i-3E]:: Returns whether +self+ is greater than the given value. * - #>=:: Returns whether +self+ is greater than or equal to the given
* - {>=}[#method-i-3E-3D]:: Returns whether +self+ is greater than * value.
* or equal to the given value.
* *
* === Converting * === Converting
* *
* - ::sqrt:: Returns the integer square root of the given value. * - ::sqrt:: Returns the integer square root of the given value.
* - ::try_convert:: Returns the given value converted to an \Integer. * - ::try_convert:: Returns the given value converted to an \Integer.
* - #% (aliased as #modulo):: Returns +self+ modulo the given value. * - #% (aliased as #modulo):: Returns +self+ modulo the given value.
* - {&}[#method-i-26]:: Returns the bitwise AND of +self+ and the given value. * - #&:: Returns the bitwise AND of +self+ and the given value.
* - #*:: Returns the product 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 value of +self+ raised to the power of the given value.
* - #+:: Returns the sum of +self+ and the given value. * - #+:: Returns the sum of +self+ and the given value.
* - #-:: Returns the difference 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 quotient of +self+ and the given value.
* - #<<:: Returns the value of +self+ after a leftward bit-shift. * - #<<:: Returns the value of +self+ after a leftward bit-shift.
* - #>>:: Returns the value of +self+ after a rightward bit-shift. * - #>>:: Returns the value of +self+ after a rightward bit-shift.
* - #[]:: Returns a slice of bits from +self+. * - #[]:: Returns a slice of bits from +self+.
* - {^}[#method-i-5E]:: Returns the bitwise EXCLUSIVE OR of +self+ and the given value. * - #^:: Returns the bitwise EXCLUSIVE OR of +self+ and the given value.
* - #ceil:: Returns the smallest number greater than or equal to +self+. * - #ceil:: Returns the smallest number greater than or equal to +self+.
* - #chr:: Returns a 1-character string containing the character * - #chr:: Returns a 1-character string containing the character
* represented by the value of +self+. * represented by the value of +self+.
@ -3557,7 +3555,7 @@ rb_num2ull(VALUE val)
* - #to_s (aliased as #inspect):: Returns a string containing the place-value * - #to_s (aliased as #inspect):: Returns a string containing the place-value
* representation of +self+ in the given radix. * representation of +self+ in the given radix.
* - #truncate:: Returns +self+ truncated to the given precision. * - #truncate:: Returns +self+ truncated to the given precision.
* - {/}[#method-i-7C]:: Returns the bitwise OR of +self+ and the given value. * - #/:: Returns the bitwise OR of +self+ and the given value.
* *
* === Other * === Other
* *
@ -6123,7 +6121,7 @@ int_s_try_convert(VALUE self, VALUE num)
* *
* === Comparing * === Comparing
* *
* - {<=>}[#method-i-3C-3D-3E]:: Returns: * - #<=>:: Returns:
* - -1 if +self+ is less than the given value. * - -1 if +self+ is less than the given value.
* - 0 if +self+ is equal to 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.

View File

@ -4119,11 +4119,9 @@ f_sprintf(int c, const VALUE *v, VALUE _)
* These are the methods defined for \BasicObject: * These are the methods defined for \BasicObject:
* *
* - ::new:: Returns a new \BasicObject instance. * - ::new:: Returns a new \BasicObject instance.
* - {!}[#method-i-21]:: Returns the boolean negation of +self+: +true+ or +false+. * - #!:: Returns the boolean negation of +self+: +true+ or +false+.
* - {!=}[#method-i-21-3D]:: Returns whether +self+ and the given object * - #!=:: Returns whether +self+ and the given object are _not_ equal.
* are _not_ equal. * - #==:: Returns whether +self+ and the given object are equivalent.
* - {==}[#method-i-3D-3D]:: Returns whether +self+ and the given object
* are equivalent.
* - {__id__}[#method-i-__id__]:: Returns the integer object identifier for +self+. * - {__id__}[#method-i-__id__]:: Returns the integer object identifier for +self+.
* - {__send__}[#method-i-__send__]:: Calls the method identified by the given symbol. * - {__send__}[#method-i-__send__]:: Calls the method identified by the given symbol.
* - #equal?:: Returns whether +self+ and the given object are the same object. * - #equal?:: Returns whether +self+ and the given object are the same object.
@ -4173,11 +4171,10 @@ f_sprintf(int c, const VALUE *v, VALUE _)
* *
* === Querying * === Querying
* *
* - {!~}[#method-i-21~]:: Returns +true+ if +self+ does not match the given object, * - #!~:: Returns +true+ if +self+ does not match the given object,
* otherwise +false+. * otherwise +false+.
* - {<=>}[#method-i-3C-3D-3E]:: Returns 0 if +self+ and the given object +object+ * - #<=>:: Returns 0 if +self+ and the given object +object+ are the same
* are the same object, or if * object, or if <tt>self == object</tt>; otherwise returns +nil+.
* <tt>self == object</tt>; otherwise returns +nil+.
* - #===:: Implements case equality, effectively the same as calling #==. * - #===:: Implements case equality, effectively the same as calling #==.
* - #eql?:: Implements hash equality, effectively the same as calling #==. * - #eql?:: Implements hash equality, effectively the same as calling #==.
* - #kind_of? (aliased as #is_a?):: Returns whether given argument is an ancestor * - #kind_of? (aliased as #is_a?):: Returns whether given argument is an ancestor
@ -4319,14 +4316,13 @@ InitVM_Object(void)
* *
* === Converting * === Converting
* *
* - {#Array}[#method-i-Array]:: Returns an Array based on the given argument. * - #Array:: Returns an Array based on the given argument.
* - {#Complex}[#method-i-Complex]:: Returns a Complex based on the given arguments. * - #Complex:: Returns a Complex based on the given arguments.
* - {#Float}[#method-i-Float]:: Returns a Float based on the given arguments. * - #Float:: Returns a Float based on the given arguments.
* - {#Hash}[#method-i-Hash]:: Returns a Hash based on the given argument. * - #Hash:: Returns a Hash based on the given argument.
* - {#Integer}[#method-i-Integer]:: Returns an Integer based on the given arguments. * - #Integer:: Returns an Integer based on the given arguments.
* - {#Rational}[#method-i-Rational]:: Returns a Rational * - #Rational:: Returns a Rational based on the given arguments.
* based on the given arguments. * - #String:: Returns a String based on the given argument.
* - {#String}[#method-i-String]:: Returns a String based on the given argument.
* *
* === Querying * === Querying
* *

View File

@ -2171,7 +2171,7 @@ range_count(int argc, VALUE *argv, VALUE range)
* *
* A user-defined class that is to be used in a range * A user-defined class that is to be used in a range
* must implement instance <tt><=></tt>; * must implement instance <tt><=></tt>;
* see {Integer#<=>}[Integer.html#method-i-3C-3D-3E]. * see Integer#<=>.
* To make iteration available, it must also implement * To make iteration available, it must also implement
* instance method +succ+; see Integer#succ. * instance method +succ+; see Integer#succ.
* *
@ -2243,8 +2243,7 @@ range_count(int argc, VALUE *argv, VALUE range)
* *
* === Methods for Comparing * === Methods for Comparing
* *
* - {#==}[#method-i-3D-3D]:: Returns whether a given object is equal to +self+ * - #==:: Returns whether a given object is equal to +self+ (uses #==).
* (uses #==).
* - #===:: Returns whether the given object is between the begin and end values. * - #===:: Returns whether the given object is between the begin and end values.
* - #cover?:: Returns whether a given object is within +self+. * - #cover?:: Returns whether a given object is within +self+.
* - #eql?:: Returns whether a given object is equal to +self+ (uses #eql?). * - #eql?:: Returns whether a given object is equal to +self+ (uses #eql?).

View File

@ -4188,7 +4188,7 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
* returned by <tt>object =~ self</tt>. * returned by <tt>object =~ self</tt>.
* *
* Note that <tt>string =~ regexp</tt> is different from <tt>regexp =~ string</tt> * Note that <tt>string =~ regexp</tt> is different from <tt>regexp =~ string</tt>
* (see {Regexp#=~}[Regexp.html#method-i-3D~]): * (see Regexp#=~):
* *
* number= nil * number= nil
* "no. 9" =~ /(?<number>\d+)/ * "no. 9" =~ /(?<number>\d+)/
@ -11323,9 +11323,10 @@ rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str)
* *
* === Methods for Comparing * === Methods for Comparing
* *
* - {#<=>}[#method-i-3C-3D-3E]:: Returns -1, 0, or 1 as a given symbol is smaller than, equal to, or larger than symbol. * - #<=>:: Returns -1, 0, or 1 as a given symbol is smaller than, equal to,
* - {#==, #===}[#method-i-3D-3D]:: Returns +true+ if a given symbol * or larger than symbol.
* has the same content and encoding. * - #==, #===:: Returns +true+ if a given symbol has the same content and
* encoding.
* - #casecmp:: Ignoring case, returns -1, 0, or 1 as a given * - #casecmp:: Ignoring case, returns -1, 0, or 1 as a given
* symbol is smaller than, equal to, or larger than symbol. * symbol is smaller than, equal to, or larger than symbol.
* - #casecmp?:: Returns +true+ if symbol is equal to a given symbol * - #casecmp?:: Returns +true+ if symbol is equal to a given symbol
@ -12116,10 +12117,10 @@ rb_enc_interned_str_cstr(const char *ptr, rb_encoding *enc)
* *
* === Methods for a Frozen/Unfrozen String * === Methods for a Frozen/Unfrozen String
* *
* - {#+string}[#method-i-2B-40]:: Returns a string that is not frozen: * - #+string:: Returns a string that is not frozen: +self+, if not frozen;
* +self+, if not frozen; +self.dup+ otherwise. * +self.dup+ otherwise.
* - {#-string}[#method-i-2D-40]:: Returns a string that is frozen: * - #-string:: Returns a string that is frozen: +self+, if already frozen;
* +self+, if already frozen; +self.freeze+ otherwise. * +self.freeze+ otherwise.
* - #freeze:: Freezes +self+, if not already frozen; returns +self+. * - #freeze:: Freezes +self+, if not already frozen; returns +self+.
* *
* === Methods for Querying * === Methods for Querying
@ -12160,9 +12161,10 @@ rb_enc_interned_str_cstr(const char *ptr, rb_encoding *enc)
* *
* === Methods for Comparing * === Methods for Comparing
* *
* - {#==, #===}[#method-i-3D-3D]:: Returns +true+ if a given other string has the same content as +self+. * - #==, #===:: Returns +true+ if a given other string has the same content as +self+.
* - #eql?:: Returns +true+ if the content is the same as the given other string. * - #eql?:: Returns +true+ if the content is the same as the given other string.
* - {#<=>}[#method-i-3C-3D-3E]:: Returns -1, 0, or 1 as a given other string is smaller than, equal to, or larger than +self+. * - #<=>:: Returns -1, 0, or 1 as a given other string is smaller than,
* equal to, or larger than +self+.
* - #casecmp:: Ignoring case, returns -1, 0, or 1 as a given * - #casecmp:: Ignoring case, returns -1, 0, or 1 as a given
* other string is smaller than, equal to, or larger than +self+. * other string is smaller than, equal to, or larger than +self+.
* - #casecmp?:: Returns +true+ if the string is equal to a given string after Unicode case folding; * - #casecmp?:: Returns +true+ if the string is equal to a given string after Unicode case folding;

View File

@ -1587,8 +1587,8 @@ rb_struct_dig(int argc, VALUE *argv, VALUE self)
* *
* === Methods for Comparing * === Methods for Comparing
* *
* {#==}[#method-i-3D-3D]:: Returns whether a given object is equal to +self+, * #==:: Returns whether a given object is equal to +self+, using <tt>==</tt>
* using <tt>==</tt> to compare member values. * to compare member values.
* #eql?:: Returns whether a given object is equal to +self+, * #eql?:: Returns whether a given object is equal to +self+,
* using <tt>eql?</tt> to compare member values. * using <tt>eql?</tt> to compare member values.
* *

View File

@ -117,8 +117,7 @@
# - ::at: Returns a new time based on seconds since epoch. # - ::at: Returns a new time based on seconds since epoch.
# - ::now: Returns a new time based on the current system time. # - ::now: Returns a new time based on the current system time.
# - #+ (plus): Returns a new time increased by the given number of seconds. # - #+ (plus): Returns a new time increased by the given number of seconds.
# - {-}[#method-i-2D] (minus): Returns a new time # - #- (minus): Returns a new time decreased by the given number of seconds.
# decreased by the given number of seconds.
# #
# === Methods for Fetching # === Methods for Fetching
# #
@ -158,7 +157,7 @@
# #
# === Methods for Comparing # === Methods for Comparing
# #
# - {#<=>}[#method-i-3C-3D-3E]: Compares +self+ to another time. # - #<=>: Compares +self+ to another time.
# - #eql?: Returns whether the time is equal to another time. # - #eql?: Returns whether the time is equal to another time.
# #
# === Methods for Converting # === Methods for Converting