From 300f4677c93fb7ce312bba27e50b0af51ce8ba2e Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 26 Mar 2022 21:07:06 +0900 Subject: [PATCH] [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. --- array.c | 10 +++++----- hash.c | 8 ++++---- numeric.c | 32 ++++++++++++++++---------------- string.c | 11 +++++------ 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/array.c b/array.c index 672aff7be8..8f79761b7b 100644 --- a/array.c +++ b/array.c @@ -8193,9 +8193,9 @@ 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. + * + * - #<=>: 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 == to the corresponding element * in a given object. * - #eql?: Returns whether each element in +self+ is eql? to the corresponding @@ -8277,12 +8277,12 @@ 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 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. * - #union: Returns an array containing all elements of +self+ and all elements of given arrays, * duplicates removed. diff --git a/hash.c b/hash.c index 27b4390345..da85fd35c6 100644 --- a/hash.c +++ b/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. + * - #<: 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+. - * - {>}[#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 superset of a given object + * - #>=: Returns whether +self+ is a proper superset of a given object. * * ==== Methods for Fetching * diff --git a/numeric.c b/numeric.c index ce9537d8d6..91f8c2bd87 100644 --- a/numeric.c +++ b/numeric.c @@ -975,14 +975,14 @@ 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 + * - #<: 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. - * - {>}[#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 greater than the given value. + * - #>=: Returns whether +self+ is greater than or equal to the given value. * * === 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 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+ @@ -3510,30 +3510,30 @@ 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 + * - #<: 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. - * - {>}[#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 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. * - #**: 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+. @@ -3553,7 +3553,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 * @@ -6119,7 +6119,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. diff --git a/string.c b/string.c index 9d200ecb20..3cf8d38a2d 100644 --- a/string.c +++ b/string.c @@ -11443,9 +11443,8 @@ rb_str_unicode_normalized_p(int argc, VALUE *argv, VALUE str) * === Methods for Querying * * - ::all_symbols:: Returns an array of the symbols currently in Ruby's symbol table. - * - {#=~}[#method-i-3D~]:: Returns the index of the first substring - * in symbol that matches a given Regexp - * or other object; returns +nil+ if no match is found. + * - #=~:: Returns the index of the first substring in symbol that matches a + * given Regexp or other object; returns +nil+ if no match is found. * - #[], #slice :: Returns a substring of symbol * determined by a given index, start/length, or range, or string. * - #empty?:: Returns +true+ if +self.length+ is zero; +false+ otherwise. @@ -11729,7 +11728,7 @@ sym_cmp(VALUE sym, VALUE other) * call-seq: * 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(:abcdef) # => 0 @@ -12274,8 +12273,8 @@ rb_enc_interned_str_cstr(const char *ptr, rb_encoding *enc) * * _Substrings_ * - * - {#=~}[#method-i-3D~]:: Returns the index of the first substring that matches a given Regexp or other object; - * returns +nil+ if no match is found. + * - #=~:: Returns the index of the first substring that matches a given + * Regexp or other object; returns +nil+ if no match is found. * - #index:: Returns the index of the _first_ occurrence of a given substring; * returns +nil+ if none found. * - #rindex:: Returns the index of the _last_ occurrence of a given substring;