1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[DOC] Use simple references to operator methods

Method references is not only able to be marked up as code, also
reflects `--show-hash` option.
The bug that prevented the old rdoc from correctly parsing these
methods was fixed last month.
This commit is contained in:
Nobuyoshi Nakada 2022-03-26 21:07:06 +09:00
parent 4acc757d04
commit 300f4677c9
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
4 changed files with 30 additions and 31 deletions

10
array.c
View file

@ -8193,9 +8193,9 @@ 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 * - #<=>: Returns -1, 0, or 1 * as +self+ is less than, equal to, or
* as +self+ is less than, equal to, or greater than a given object. * greater than a given object.
* - #==: Returns whether each element in +self+ is <tt>==</tt> to the corresponding element * - #==: Returns whether each element in +self+ is <tt>==</tt> to the corresponding element
* in a given object. * 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
@ -8277,12 +8277,12 @@ 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 containing all elements of +self+ that are not found in a given array. * - #-: Returns an array containing 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.

8
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.
* - #==: 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
* *

View file

@ -975,14 +975,14 @@ 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 or equal to the given value. * - #<=: 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 * - #<=>: Returns a number indicating whether +self+ is less than, equal
* to, or greater than the given value. * to, or greater than the given value.
* - #== (aliased as #=== and #eql?): Returns whether +self+ is equal to * - #== (aliased as #=== and #eql?): Returns whether +self+ is equal to
* the given value. * the given value.
* - {>}[#method-i-3E]: Returns whether +self+ is greater than the given value. * - #>: 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 greater than or equal to the given value.
* *
* === Converting * === Converting
* *
@ -991,7 +991,7 @@ num_negative_p(VALUE num)
* - #**: 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+
@ -3510,30 +3510,30 @@ 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 or equal to the given value. * - #<=: 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 * - #<=>: Returns a number indicating whether +self+ is less than, equal
* to, or greater than the given value. * to, or greater than the given value.
* - #== (aliased as #===): Returns whether +self+ is equal to the given * - #== (aliased as #===): Returns whether +self+ is equal to the given
* value. * value.
* - {>}[#method-i-3E]: Returns whether +self+ is greater than the given value. * - #>: 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 greater than 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.
* - #**: 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+.
@ -3553,7 +3553,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
* *
@ -6119,7 +6119,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.

View file

@ -11443,9 +11443,8 @@ rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str)
* === Methods for Querying * === Methods for Querying
* *
* - ::all_symbols:: Returns an array of the symbols currently in Ruby's symbol table. * - ::all_symbols:: Returns an array of the symbols currently in Ruby's symbol table.
* - {#=~}[#method-i-3D~]:: Returns the index of the first substring * - #=~:: Returns the index of the first substring in symbol that matches a
* in symbol that matches a given Regexp * given Regexp or other object; returns +nil+ if no match is found.
* or other object; returns +nil+ if no match is found.
* - #[], #slice :: Returns a substring of symbol * - #[], #slice :: Returns a substring of symbol
* determined by a given index, start/length, or range, or string. * determined by a given index, start/length, or range, or string.
* - #empty?:: Returns +true+ if +self.length+ is zero; +false+ otherwise. * - #empty?:: Returns +true+ if +self.length+ is zero; +false+ otherwise.
@ -11729,7 +11728,7 @@ sym_cmp(VALUE sym, VALUE other)
* call-seq: * call-seq:
* casecmp(other_symbol) -> -1, 0, 1, or nil * casecmp(other_symbol) -> -1, 0, 1, or nil
* *
* Case-insensitive version of {Symbol#<=>}[#method-i-3C-3D-3E]: * Case-insensitive version of #<=>:
* *
* :aBcDeF.casecmp(:abcde) # => 1 * :aBcDeF.casecmp(:abcde) # => 1
* :aBcDeF.casecmp(:abcdef) # => 0 * :aBcDeF.casecmp(:abcdef) # => 0
@ -12274,8 +12273,8 @@ rb_enc_interned_str_cstr(const char *ptr, rb_encoding *enc)
* *
* _Substrings_ * _Substrings_
* *
* - {#=~}[#method-i-3D~]:: Returns the index of the first substring that matches a given Regexp or other object; * - #=~:: Returns the index of the first substring that matches a given
* returns +nil+ if no match is found. * Regexp or other object; returns +nil+ if no match is found.
* - #index:: Returns the index of the _first_ occurrence of a given substring; * - #index:: Returns the index of the _first_ occurrence of a given substring;
* returns +nil+ if none found. * returns +nil+ if none found.
* - #rindex:: Returns the index of the _last_ occurrence of a given substring; * - #rindex:: Returns the index of the _last_ occurrence of a given substring;