mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[DOC] Simplify operator method references
This commit is contained in:
parent
e6b537e605
commit
50c972a1ae
10 changed files with 78 additions and 85 deletions
17
array.c
17
array.c
|
@ -5001,7 +5001,7 @@ recursive_eql(VALUE ary1, VALUE ary2, int recur)
|
|||
*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
|
@ -8119,10 +8119,11 @@ rb_ary_deconstruct(VALUE ary)
|
|||
* #hash:: Returns the integer hash code.
|
||||
*
|
||||
* === 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.
|
||||
* {#==}[#method-i-3D-3D]:: Returns whether each element in +self+ is <tt>==</tt> to the
|
||||
* corresponding element in a given object.
|
||||
|
||||
* #<=>:: Returns -1, 0, or 1 as +self+ is less than, equal to, or greater than 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
|
||||
* element in a given object.
|
||||
|
||||
|
@ -8202,13 +8203,13 @@ rb_ary_deconstruct(VALUE ary)
|
|||
*
|
||||
* === 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+
|
||||
* and in each 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.
|
||||
* {#|}[#method-i-7C]:: Returns an array containing all elements of +self+ and all elements of a given array,
|
||||
* duplicates removed.
|
||||
* #|:: Returns an array containing all elements of +self+ and all elements of a given array,
|
||||
* duplicates removed.
|
||||
* #union:: Returns an array containing all elements of +self+ and all elements of given arrays,
|
||||
* duplicates removed.
|
||||
* #difference:: Returns an array containing all elements of +self+ that are not found
|
||||
|
|
12
compar.c
12
compar.c
|
@ -288,13 +288,11 @@ cmp_clamp(int argc, VALUE *argv, VALUE x)
|
|||
*
|
||||
* \Module \Comparable provides these methods, all of which use method <tt><=></tt>:
|
||||
*
|
||||
* - {<}[#method-i-3C]:: Returns whether +self+ is less than the given object.
|
||||
* - {<=}[#method-i-3C-3D]:: Returns whether +self+ is less than or equal to
|
||||
* the given object.
|
||||
* - {==}[#method-i-3D-3D]:: Returns whether +self+ is equal to the given object.
|
||||
* - {>}[#method-i-3E]:: Returns whether +self+ is greater than or equal to
|
||||
* the given object.
|
||||
* - {>=}[#method-i-3E-3D]:: Returns whether +self+ is greater than the given object.
|
||||
* - #<:: Returns whether +self+ is less than the given object.
|
||||
* - #<=:: Returns whether +self+ is less than or equal to the given object.
|
||||
* - #==:: Returns whether +self+ is equal to the given object.
|
||||
* - #>:: Returns whether +self+ is greater than or equal to the given object.
|
||||
* - #>=:: Returns whether +self+ is greater than the given object.
|
||||
* - #between? Returns +true+ if +self+ is between two given objects.
|
||||
* - #clamp:: For given objects +min+ and +max+, or range <tt>(min..max)</tt>, returns:
|
||||
* - +min+ if <tt>(self <=> min) < 0</tt>.
|
||||
|
|
10
hash.c
10
hash.c
|
@ -7063,11 +7063,11 @@ static const rb_data_type_t env_data_type = {
|
|||
*
|
||||
* ==== Methods for Comparing
|
||||
*
|
||||
* {#<}[#method-i-3C]:: 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.
|
||||
* {#==}[#method-i-3D-3D]:: Returns whether a given object is equal to +self+.
|
||||
* {#>}[#method-i-3E]:: 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 subset of a given object.
|
||||
* #<=:: Returns whether +self+ is a subset of a given object.
|
||||
* #==:: Returns whether a given object is equal to +self+.
|
||||
* #>:: 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
|
||||
*
|
||||
|
|
2
io.c
2
io.c
|
@ -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,
|
||||
* in binary mode.
|
||||
* - ::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+.
|
||||
* - #printf:: Writes to +self+ based on the given format string and objects.
|
||||
* - #putc:: Writes a character to +self+.
|
||||
|
|
54
numeric.c
54
numeric.c
|
@ -975,25 +975,24 @@ num_negative_p(VALUE num)
|
|||
*
|
||||
* === 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 #=== and #eql>):: 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.
|
||||
* - #<:: Returns whether +self+ is less than the given value.
|
||||
* - #<=:: Returns whether +self+ is less than or equal to the given value.
|
||||
* - #<=>:: Returns a number indicating whether +self+ is less than, equal
|
||||
* to, or greater than the given value.
|
||||
* - #== (aliased as #=== and #eql?):: Returns whether +self+ is equal to
|
||||
* the given value.
|
||||
* - #>:: Returns whether +self+ is greater than the given value.
|
||||
* - #>=:: Returns whether +self+ is greater than or equal to the given
|
||||
* value.
|
||||
*
|
||||
* === Converting
|
||||
*
|
||||
* - #% (aliased as #modulo):: Returns +self+ modulo 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 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+.
|
||||
* - #coerce:: Returns a 2-element array containing the given value converted to a \Float
|
||||
and +self+
|
||||
|
@ -3512,32 +3511,31 @@ rb_num2ull(VALUE val)
|
|||
*
|
||||
* === 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.
|
||||
* - #<:: Returns whether +self+ is less than the given value.
|
||||
* - #<=:: Returns whether +self+ is less than or equal to the given value.
|
||||
* - #<=>:: Returns a number indicating whether +self+ is less than, equal
|
||||
* to, or greater than the given value.
|
||||
* - #== (aliased as #===):: Returns whether +self+ is equal to the given
|
||||
* value.
|
||||
* - #>:: Returns whether +self+ is greater than the given value.
|
||||
* - #>=:: 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 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 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 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.
|
||||
* - #^:: 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+.
|
||||
|
@ -3557,7 +3555,7 @@ rb_num2ull(VALUE val)
|
|||
* - #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.
|
||||
* - #/:: Returns the bitwise OR of +self+ and the given value.
|
||||
*
|
||||
* === Other
|
||||
*
|
||||
|
@ -6123,7 +6121,7 @@ int_s_try_convert(VALUE self, VALUE num)
|
|||
*
|
||||
* === Comparing
|
||||
*
|
||||
* - {<=>}[#method-i-3C-3D-3E]:: Returns:
|
||||
* - #<=>:: 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.
|
||||
|
|
32
object.c
32
object.c
|
@ -4119,11 +4119,9 @@ f_sprintf(int c, const VALUE *v, VALUE _)
|
|||
* These are the methods defined for \BasicObject:
|
||||
*
|
||||
* - ::new:: Returns a new \BasicObject instance.
|
||||
* - {!}[#method-i-21]:: Returns the boolean negation of +self+: +true+ or +false+.
|
||||
* - {!=}[#method-i-21-3D]:: Returns whether +self+ and the given object
|
||||
* are _not_ equal.
|
||||
* - {==}[#method-i-3D-3D]:: Returns whether +self+ and the given object
|
||||
* are equivalent.
|
||||
* - #!:: Returns the boolean negation of +self+: +true+ or +false+.
|
||||
* - #!=:: Returns whether +self+ and the given object are _not_ equal.
|
||||
* - #==:: Returns whether +self+ and the given object are equivalent.
|
||||
* - {__id__}[#method-i-__id__]:: Returns the integer object identifier for +self+.
|
||||
* - {__send__}[#method-i-__send__]:: Calls the method identified by the given symbol.
|
||||
* - #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
|
||||
*
|
||||
* - {!~}[#method-i-21~]:: Returns +true+ if +self+ does not match the given object,
|
||||
* otherwise +false+.
|
||||
* - {<=>}[#method-i-3C-3D-3E]:: Returns 0 if +self+ and the given object +object+
|
||||
* are the same object, or if
|
||||
* <tt>self == object</tt>; otherwise returns +nil+.
|
||||
* - #!~:: Returns +true+ if +self+ does not match the given object,
|
||||
* otherwise +false+.
|
||||
* - #<=>:: Returns 0 if +self+ and the given object +object+ are the same
|
||||
* object, or if <tt>self == object</tt>; otherwise returns +nil+.
|
||||
* - #===:: Implements case 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
|
||||
|
@ -4319,14 +4316,13 @@ InitVM_Object(void)
|
|||
*
|
||||
* === Converting
|
||||
*
|
||||
* - {#Array}[#method-i-Array]:: Returns an Array based on the given argument.
|
||||
* - {#Complex}[#method-i-Complex]:: Returns a Complex based on the given arguments.
|
||||
* - {#Float}[#method-i-Float]:: Returns a Float based on the given arguments.
|
||||
* - {#Hash}[#method-i-Hash]:: Returns a Hash based on the given argument.
|
||||
* - {#Integer}[#method-i-Integer]:: Returns an Integer based on the given arguments.
|
||||
* - {#Rational}[#method-i-Rational]:: Returns a Rational
|
||||
* based on the given arguments.
|
||||
* - {#String}[#method-i-String]:: Returns a String based on the given argument.
|
||||
* - #Array:: Returns an Array based on the given argument.
|
||||
* - #Complex:: Returns a Complex based on the given arguments.
|
||||
* - #Float:: Returns a Float based on the given arguments.
|
||||
* - #Hash:: Returns a Hash based on the given argument.
|
||||
* - #Integer:: Returns an Integer based on the given arguments.
|
||||
* - #Rational:: Returns a Rational based on the given arguments.
|
||||
* - #String:: Returns a String based on the given argument.
|
||||
*
|
||||
* === Querying
|
||||
*
|
||||
|
|
5
range.c
5
range.c
|
@ -2171,7 +2171,7 @@ range_count(int argc, VALUE *argv, VALUE range)
|
|||
*
|
||||
* A user-defined class that is to be used in a range
|
||||
* must implement instance <tt><=></tt>;
|
||||
* see {Integer#<=>}[Integer.html#method-i-3C-3D-3E].
|
||||
* see Integer#<=>.
|
||||
* To make iteration available, it must also implement
|
||||
* instance method +succ+; see Integer#succ.
|
||||
*
|
||||
|
@ -2243,8 +2243,7 @@ range_count(int argc, VALUE *argv, VALUE range)
|
|||
*
|
||||
* === Methods for Comparing
|
||||
*
|
||||
* - {#==}[#method-i-3D-3D]:: Returns whether a given object is equal to +self+
|
||||
* (uses #==).
|
||||
* - #==:: Returns whether a given object is equal to +self+ (uses #==).
|
||||
* - #===:: Returns whether the given object is between the begin and end values.
|
||||
* - #cover?:: Returns whether a given object is within +self+.
|
||||
* - #eql?:: Returns whether a given object is equal to +self+ (uses #eql?).
|
||||
|
|
22
string.c
22
string.c
|
@ -4188,7 +4188,7 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
|
|||
* returned by <tt>object =~ self</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
|
||||
* "no. 9" =~ /(?<number>\d+)/
|
||||
|
@ -11323,9 +11323,10 @@ rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str)
|
|||
*
|
||||
* === 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.
|
||||
* - {#==, #===}[#method-i-3D-3D]:: Returns +true+ if a given symbol
|
||||
* has the same content and encoding.
|
||||
* - #<=>:: Returns -1, 0, or 1 as a given symbol is smaller than, equal to,
|
||||
* or larger than symbol.
|
||||
* - #==, #===:: Returns +true+ if a given symbol has the same content and
|
||||
* encoding.
|
||||
* - #casecmp:: Ignoring case, returns -1, 0, or 1 as a given
|
||||
* symbol is smaller than, equal to, or larger than 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
|
||||
*
|
||||
* - {#+string}[#method-i-2B-40]:: Returns a string that is not frozen:
|
||||
* +self+, if not frozen; +self.dup+ otherwise.
|
||||
* - {#-string}[#method-i-2D-40]:: Returns a string that is frozen:
|
||||
* +self+, if already frozen; +self.freeze+ otherwise.
|
||||
* - #+string:: Returns a string that is not frozen: +self+, if not frozen;
|
||||
* +self.dup+ otherwise.
|
||||
* - #-string:: Returns a string that is frozen: +self+, if already frozen;
|
||||
* +self.freeze+ otherwise.
|
||||
* - #freeze:: Freezes +self+, if not already frozen; returns +self+.
|
||||
*
|
||||
* === Methods for Querying
|
||||
|
@ -12160,9 +12161,10 @@ rb_enc_interned_str_cstr(const char *ptr, rb_encoding *enc)
|
|||
*
|
||||
* === 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.
|
||||
* - {#<=>}[#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
|
||||
* 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;
|
||||
|
|
4
struct.c
4
struct.c
|
@ -1587,8 +1587,8 @@ rb_struct_dig(int argc, VALUE *argv, VALUE self)
|
|||
*
|
||||
* === Methods for Comparing
|
||||
*
|
||||
* {#==}[#method-i-3D-3D]:: Returns whether a given object is equal to +self+,
|
||||
* using <tt>==</tt> to compare member values.
|
||||
* #==:: Returns whether a given object is equal to +self+, using <tt>==</tt>
|
||||
* to compare member values.
|
||||
* #eql?:: Returns whether a given object is equal to +self+,
|
||||
* using <tt>eql?</tt> to compare member values.
|
||||
*
|
||||
|
|
5
timev.rb
5
timev.rb
|
@ -117,8 +117,7 @@
|
|||
# - ::at: Returns a new time based on seconds since epoch.
|
||||
# - ::now: Returns a new time based on the current system time.
|
||||
# - #+ (plus): Returns a new time increased by the given number of seconds.
|
||||
# - {-}[#method-i-2D] (minus): Returns a new time
|
||||
# decreased by the given number of seconds.
|
||||
# - #- (minus): Returns a new time decreased by the given number of seconds.
|
||||
#
|
||||
# === Methods for Fetching
|
||||
#
|
||||
|
@ -158,7 +157,7 @@
|
|||
#
|
||||
# === 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.
|
||||
#
|
||||
# === Methods for Converting
|
||||
|
|
Loading…
Add table
Reference in a new issue