[DOC] Repair format and links in What's Here sections (#5711)

* Repair format and links in What's Here for Comparable and Array

* Repair format for What's Here in enum.c
This commit is contained in:
Burdette Lamar 2022-03-25 10:52:06 -05:00 коммит произвёл GitHub
Родитель 69967ee64e
Коммит f918f6e4e7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 204 добавлений и 194 удалений

250
array.c
Просмотреть файл

@ -8174,163 +8174,165 @@ rb_ary_deconstruct(VALUE ary)
*
* === Methods for Creating an \Array
*
* ::[]:: Returns a new array populated with given objects.
* ::new:: Returns a new array.
* ::try_convert:: Returns a new array created from a given object.
* - ::[]: Returns a new array populated with given objects.
* - ::new: Returns a new array.
* - ::try_convert: Returns a new array created from a given object.
*
* === Methods for Querying
*
* #length, #size:: Returns the count of elements.
* #include?:: Returns whether any element <tt>==</tt> a given object.
* #empty?:: Returns whether there are no elements.
* #all?:: Returns whether all elements meet a given criterion.
* #any?:: Returns whether any element meets a given criterion.
* #none?:: Returns whether no element <tt>==</tt> a given object.
* #one?:: Returns whether exactly one element <tt>==</tt> a given object.
* #count:: Returns the count of elements that meet a given criterion.
* #find_index, #index:: Returns the index of the first element that meets a given criterion.
* #rindex:: Returns the index of the last element that meets a given criterion.
* #hash:: Returns the integer hash code.
* - #length, #size: Returns the count of elements.
* - #include?: Returns whether any element <tt>==</tt> a given object.
* - #empty?: Returns whether there are no elements.
* - #all?: Returns whether all elements meet a given criterion.
* - #any?: Returns whether any element meets a given criterion.
* - #none?: Returns whether no element <tt>==</tt> a given object.
* - #one?: Returns whether exactly one element <tt>==</tt> a given object.
* - #count: Returns the count of elements that meet a given criterion.
* - #find_index, #index: Returns the index of the first element that meets a given criterion.
* - #rindex: Returns the index of the last element that meets a given criterion.
* - #hash: Returns the integer hash code.
*
* === Methods for Comparing
* #<=>:: 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.
* - {<=>}[Array.html#method-i-3C-3D-3E]: 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.
* === Methods for Fetching
*
* These methods do not modify +self+.
*
* #[]:: Returns one or more elements.
* #fetch:: Returns the element at a given offset.
* #first:: Returns one or more leading elements.
* #last:: Returns one or more trailing elements.
* #max:: Returns one or more maximum-valued elements,
* as determined by <tt><=></tt> or a given block.
* #min:: Returns one or more minimum-valued elements,
* as determined by <tt><=></tt> or a given block.
* #minmax:: Returns the minimum-valued and maximum-valued elements,
* as determined by <tt><=></tt> or a given block.
* #assoc:: Returns the first element that is an array
* whose first element <tt>==</tt> a given object.
* #rassoc:: Returns the first element that is an array
* whose second element <tt>==</tt> a given object.
* #at:: Returns the element at a given offset.
* #values_at:: Returns the elements at given offsets.
* #dig:: Returns the object in nested objects
* that is specified by a given index and additional arguments.
* #drop:: Returns trailing elements as determined by a given index.
* #take:: Returns leading elements as determined by a given index.
* #drop_while:: Returns trailing elements as determined by a given block.
* #take_while:: Returns leading elements as determined by a given block.
* #slice:: Returns consecutive elements as determined by a given argument.
* #sort:: Returns all elements in an order determined by <tt><=></tt> or a given block.
* #reverse:: Returns all elements in reverse order.
* #compact:: Returns an array containing all non-+nil+ elements.
* #select, #filter:: Returns an array containing elements selected by a given block.
* #uniq:: Returns an array containing non-duplicate elements.
* #rotate:: Returns all elements with some rotated from one end to the other.
* #bsearch:: Returns an element selected via a binary search
* as determined by a given block.
* #bsearch_index:: Returns the index of an element selected via a binary search
* as determined by a given block.
* #sample:: Returns one or more random elements.
* #shuffle:: Returns elements in a random order.
* - #[]: Returns one or more elements.
* - #fetch: Returns the element at a given offset.
* - #first: Returns one or more leading elements.
* - #last: Returns one or more trailing elements.
* - #max: Returns one or more maximum-valued elements,
* as determined by <tt><=></tt> or a given block.
* - #min: Returns one or more minimum-valued elements,
* as determined by <tt><=></tt> or a given block.
* - #minmax: Returns the minimum-valued and maximum-valued elements,
* as determined by <tt><=></tt> or a given block.
* - #assoc: Returns the first element that is an array
* whose first element <tt>==</tt> a given object.
* - #rassoc: Returns the first element that is an array
* whose second element <tt>==</tt> a given object.
* - #at: Returns the element at a given offset.
* - #values_at: Returns the elements at given offsets.
* - #dig: Returns the object in nested objects
* that is specified by a given index and additional arguments.
* - #drop: Returns trailing elements as determined by a given index.
* - #take: Returns leading elements as determined by a given index.
* - #drop_while: Returns trailing elements as determined by a given block.
* - #take_while: Returns leading elements as determined by a given block.
* - #slice: Returns consecutive elements as determined by a given argument.
* - #sort: Returns all elements in an order determined by <tt><=></tt> or a given block.
* - #reverse: Returns all elements in reverse order.
* - #compact: Returns an array containing all non-+nil+ elements.
* - #select, #filter: Returns an array containing elements selected by a given block.
* - #uniq: Returns an array containing non-duplicate elements.
* - #rotate: Returns all elements with some rotated from one end to the other.
* - #bsearch: Returns an element selected via a binary search
* as determined by a given block.
* - #bsearch_index: Returns the index of an element selected via a binary search
* as determined by a given block.
* - #sample: Returns one or more random elements.
* - #shuffle: Returns elements in a random order.
*
* === Methods for Assigning
*
* These methods add, replace, or reorder elements in +self+.
*
* #[]=:: Assigns specified elements with a given object.
* #push, #append, #<<:: Appends trailing elements.
* #unshift, #prepend:: Prepends leading elements.
* #insert:: Inserts given objects at a given offset; does not replace elements.
* #concat:: Appends all elements from given arrays.
* #fill:: Replaces specified elements with specified objects.
* #replace:: Replaces the content of +self+ with the content of a given array.
* #reverse!:: Replaces +self+ with its elements reversed.
* #rotate!:: Replaces +self+ with its elements rotated.
* #shuffle!:: Replaces +self+ with its elements in random order.
* #sort!:: Replaces +self+ with its elements sorted,
* as determined by <tt><=></tt> or a given block.
* #sort_by!:: Replaces +self+ with its elements sorted, as determined by a given block.
* - #[]=: Assigns specified elements with a given object.
* - #push, #append, #<<: Appends trailing elements.
* - #unshift, #prepend: Prepends leading elements.
* - #insert: Inserts given objects at a given offset; does not replace elements.
* - #concat: Appends all elements from given arrays.
* - #fill: Replaces specified elements with specified objects.
* - #replace: Replaces the content of +self+ with the content of a given array.
* - #reverse!: Replaces +self+ with its elements reversed.
* - #rotate!: Replaces +self+ with its elements rotated.
* - #shuffle!: Replaces +self+ with its elements in random order.
* - #sort!: Replaces +self+ with its elements sorted,
* as determined by <tt><=></tt> or a given block.
* - #sort_by!: Replaces +self+ with its elements sorted, as determined by a given block.
*
* === Methods for Deleting
*
* Each of these methods removes elements from +self+:
*
* #pop:: Removes and returns the last element.
* #shift:: Removes and returns the first element.
* #compact!:: Removes all non-+nil+ elements.
* #delete:: Removes elements equal to a given object.
* #delete_at:: Removes the element at a given offset.
* #delete_if:: Removes elements specified by a given block.
* #keep_if:: Removes elements not specified by a given block.
* #reject!:: Removes elements specified by a given block.
* #select!, #filter!:: Removes elements not specified by a given block.
* #slice!:: Removes and returns a sequence of elements.
* #uniq!:: Removes duplicates.
* - #pop: Removes and returns the last element.
* - #shift: Removes and returns the first element.
* - #compact!: Removes all non-+nil+ elements.
* - #delete: Removes elements equal to a given object.
* - #delete_at: Removes the element at a given offset.
* - #delete_if: Removes elements specified by a given block.
* - #keep_if: Removes elements not specified by a given block.
* - #reject!: Removes elements specified by a given block.
* - #select!, #filter!: Removes elements not specified by a given block.
* - #slice!: Removes and returns a sequence of elements.
* - #uniq!: Removes duplicates.
*
* === Methods for Combining
*
* #&:: 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.
* #|:: 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
* in any of the given arrays..
* #product:: Returns or yields all combinations of elements from +self+ and given arrays.
* - {&}[Array.html#method-i-26]: 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.
* - {|}[Array.html#method-i-7C]: 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
* in any of the given arrays..
* - #product: Returns or yields all combinations of elements from +self+ and given arrays.
*
* === Methods for Iterating
*
* #each:: Passes each element to a given block.
* #reverse_each:: Passes each element, in reverse order, to a given block.
* #each_index:: Passes each element index to a given block.
* #cycle:: Calls a given block with each element, then does so again,
* for a specified number of times, or forever.
* #combination:: Calls a given block with combinations of elements of +self+;
* a combination does not use the same element more than once.
* #permutation:: Calls a given block with permutations of elements of +self+;
* a permutation does not use the same element more than once.
* #repeated_combination:: Calls a given block with combinations of elements of +self+;
* a combination may use the same element more than once.
* #repeated_permutation:: Calls a given block with permutations of elements of +self+;
* a permutation may use the same element more than once.
* - #each: Passes each element to a given block.
* - #reverse_each: Passes each element, in reverse order, to a given block.
* - #each_index: Passes each element index to a given block.
* - #cycle: Calls a given block with each element, then does so again,
* for a specified number of times, or forever.
* - #combination: Calls a given block with combinations of elements of +self+;
* a combination does not use the same element more than once.
* - #permutation: Calls a given block with permutations of elements of +self+;
* a permutation does not use the same element more than once.
* - #repeated_combination: Calls a given block with combinations of elements of +self+;
* a combination may use the same element more than once.
* - #repeated_permutation: Calls a given block with permutations of elements of +self+;
* a permutation may use the same element more than once.
*
* === Methods for Converting
*
* #map, #collect:: Returns an array containing the block return-value for each element.
* #map!, #collect!:: Replaces each element with a block return-value.
* #flatten:: Returns an array that is a recursive flattening of +self+.
* #flatten!:: Replaces each nested array in +self+ with the elements from that array.
* #inspect, #to_s:: Returns a new String containing the elements.
* #join:: Returns a newsString containing the elements joined by the field separator.
* #to_a:: Returns +self+ or a new array containing all elements.
* #to_ary:: Returns +self+.
* #to_h:: Returns a new hash formed from the elements.
* #transpose:: Transposes +self+, which must be an array of arrays.
* #zip:: Returns a new array of arrays containing +self+ and given arrays;
* follow the link for details.
* - #map, #collect: Returns an array containing the block return-value for each element.
* - #map!, #collect!: Replaces each element with a block return-value.
* - #flatten: Returns an array that is a recursive flattening of +self+.
* - #flatten!: Replaces each nested array in +self+ with the elements from that array.
* - #inspect, #to_s: Returns a new String containing the elements.
* - #join: Returns a newsString containing the elements joined by the field separator.
* - #to_a: Returns +self+ or a new array containing all elements.
* - #to_ary: Returns +self+.
* - #to_h: Returns a new hash formed from the elements.
* - #transpose: Transposes +self+, which must be an array of arrays.
* - #zip: Returns a new array of arrays containing +self+ and given arrays;
* follow the link for details.
*
* === Other Methods
*
* #*:: Returns one of the following:
* - With integer argument +n+, a new array that is the concatenation
* of +n+ copies of +self+.
* - With string argument +field_separator+, a new string that is equivalent to
* <tt>join(field_separator)</tt>.
* #abbrev:: Returns a hash of unambiguous abbreviations for elements.
* #pack:: Packs the elements into a binary sequence.
* #sum:: Returns a sum of elements according to either <tt>+</tt> or a given block.
* - #*: Returns one of the following:
*
* - With integer argument +n+, a new array that is the concatenation
* of +n+ copies of +self+.
* - With string argument +field_separator+, a new string that is equivalent to
* <tt>join(field_separator)</tt>.
*
* - #abbrev: Returns a hash of unambiguous abbreviations for elements.
* - #pack: Packs the elements into a binary sequence.
* - #sum: Returns a sum of elements according to either <tt>+</tt> or a given block.
*/
void

Просмотреть файл

@ -288,16 +288,22 @@ cmp_clamp(int argc, VALUE *argv, VALUE x)
*
* \Module \Comparable provides these methods, all of which use method <tt><=></tt>:
*
* - #<:: 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:
* - {<}[Comparable.html#method-i-3C]:
* Returns whether +self+ is less than the given object.
* - {<=}[Comparable.html#method-i-3C-3D]:
* Returns whether +self+ is less than or equal to the given object.
* - #==: Returns whether +self+ is equal to the given object.
* - {>}[Comparable.html#method-i-3E]:
* Returns whether +self+ is greater than or equal to the given object.
* - {>=}[Comparable.html#method-i-3E-3D]:
* 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>.
* - +max+ if <tt>(self <=> max) > 0</tt>.
* - +self+ otherwise.
*
*/
void

126
enum.c
Просмотреть файл

@ -4658,6 +4658,7 @@ enum_compact(VALUE obj)
* == What's Here
*
* \Module \Enumerable provides methods that are useful to a collection class for:
*
* - {Querying}[rdoc-ref:Enumerable@Methods+for+Querying]
* - {Fetching}[rdoc-ref:Enumerable@Methods+for+Fetching]
* - {Searching}[rdoc-ref:Enumerable@Methods+for+Searching]
@ -4669,91 +4670,94 @@ enum_compact(VALUE obj)
*
* These methods return information about the \Enumerable other than the elements themselves:
*
* #include?, #member?:: Returns +true+ if self == object, +false+ otherwise.
* #all?:: Returns +true+ if all elements meet a specified criterion; +false+ otherwise.
* #any?:: Returns +true+ if any element meets a specified criterion; +false+ otherwise.
* #none?:: Returns +true+ if no element meets a specified criterion; +false+ otherwise.
* #one?:: Returns +true+ if exactly one element meets a specified criterion; +false+ otherwise.
* #count:: Returns the count of elements,
* based on an argument or block criterion, if given.
* #tally:: Returns a new \Hash containing the counts of occurrences of each element.
* - #include?, #member?: Returns +true+ if <tt>self == object</tt>, +false+ otherwise.
* - #all?: Returns +true+ if all elements meet a specified criterion; +false+ otherwise.
* - #any?: Returns +true+ if any element meets a specified criterion; +false+ otherwise.
* - #none?: Returns +true+ if no element meets a specified criterion; +false+ otherwise.
* - #one?: Returns +true+ if exactly one element meets a specified criterion; +false+ otherwise.
* - #count: Returns the count of elements,
* based on an argument or block criterion, if given.
* - #tally: Returns a new \Hash containing the counts of occurrences of each element.
*
* === Methods for Fetching
*
* These methods return entries from the \Enumerable, without modifying it:
*
* <i>Leading, trailing, or all elements</i>:
* #entries, #to_a:: Returns all elements.
* #first:: Returns the first element or leading elements.
* #take:: Returns a specified number of leading elements.
* #drop:: Returns a specified number of trailing elements.
* #take_while:: Returns leading elements as specified by the given block.
* #drop_while:: Returns trailing elements as specified by the given block.
*
* - #entries, #to_a: Returns all elements.
* - #first: Returns the first element or leading elements.
* - #take: Returns a specified number of leading elements.
* - #drop: Returns a specified number of trailing elements.
* - #take_while: Returns leading elements as specified by the given block.
* - #drop_while: Returns trailing elements as specified by the given block.
*
* <i>Minimum and maximum value elements</i>:
* #min:: Returns the elements whose values are smallest among the elements,
* as determined by <tt><=></tt> or a given block.
* #max:: Returns the elements whose values are largest among the elements,
* as determined by <tt><=></tt> or a given block.
* #minmax:: Returns a 2-element \Array containing the smallest and largest elements.
* #min_by:: Returns the smallest element, as determined by the given block.
* #max_by:: Returns the largest element, as determined by the given block.
* #minmax_by:: Returns the smallest and largest elements, as determined by the given block.
*
* - #min: Returns the elements whose values are smallest among the elements,
* as determined by <tt><=></tt> or a given block.
* - #max: Returns the elements whose values are largest among the elements,
* as determined by <tt><=></tt> or a given block.
* - #minmax: Returns a 2-element \Array containing the smallest and largest elements.
* - #min_by: Returns the smallest element, as determined by the given block.
* - #max_by: Returns the largest element, as determined by the given block.
* - #minmax_by: Returns the smallest and largest elements, as determined by the given block.
*
* <i>Groups, slices, and partitions</i>:
* #group_by:: Returns a \Hash that partitions the elements into groups.
* #partition:: Returns elements partitioned into two new Arrays, as determined by the given block.
* #slice_after:: Returns a new \Enumerator whose entries are a partition of +self+,
based either on a given +object+ or a given block.
* #slice_before:: Returns a new \Enumerator whose entries are a partition of +self+,
based either on a given +object+ or a given block.
* #slice_when:: Returns a new \Enumerator whose entries are a partition of +self+
based on the given block.
* #chunk:: Returns elements organized into chunks as specified by the given block.
* #chunk_while:: Returns elements organized into chunks as specified by the given block.
*
* - #group_by: Returns a \Hash that partitions the elements into groups.
* - #partition: Returns elements partitioned into two new Arrays, as determined by the given block.
* - #slice_after: Returns a new \Enumerator whose entries are a partition of +self+,
based either on a given +object+ or a given block.
* - #slice_before: Returns a new \Enumerator whose entries are a partition of +self+,
based either on a given +object+ or a given block.
* - #slice_when: Returns a new \Enumerator whose entries are a partition of +self+
based on the given block.
* - #chunk: Returns elements organized into chunks as specified by the given block.
* - #chunk_while: Returns elements organized into chunks as specified by the given block.
*
* === Methods for Searching and Filtering
*
* These methods return elements that meet a specified criterion.
* These methods return elements that meet a specified criterion:
*
* #find, #detect:: Returns an element selected by the block.
* #find_all, #filter, #select:: Returns elements selected by the block.
* #find_index:: Returns the index of an element selected by a given object or block.
* #reject:: Returns elements not rejected by the block.
* #uniq:: Returns elements that are not duplicates.
* - #find, #detect: Returns an element selected by the block.
* - #find_all, #filter, #select: Returns elements selected by the block.
* - #find_index: Returns the index of an element selected by a given object or block.
* - #reject: Returns elements not rejected by the block.
* - #uniq: Returns elements that are not duplicates.
*
* === Methods for Sorting
*
* These methods return elements in sorted order.
* These methods return elements in sorted order:
*
* #sort:: Returns the elements, sorted by <tt><=></tt> or the given block.
* #sort_by:: Returns the elements, sorted by the given block.
* - #sort: Returns the elements, sorted by <tt><=></tt> or the given block.
* - #sort_by: Returns the elements, sorted by the given block.
*
* === Methods for Iterating
*
* #each_entry:: Calls the block with each successive element
* (slightly different from #each).
* #each_with_index:: Calls the block with each successive element and its index.
* #each_with_object:: Calls the block with each successive element and a given object.
* #each_slice:: Calls the block with successive non-overlapping slices.
* #each_cons:: Calls the block with successive overlapping slices.
* (different from #each_slice).
* #reverse_each:: Calls the block with each successive element, in reverse order.
* - #each_entry: Calls the block with each successive element
* (slightly different from #each).
* - #each_with_index: Calls the block with each successive element and its index.
* - #each_with_object: Calls the block with each successive element and a given object.
* - #each_slice: Calls the block with successive non-overlapping slices.
* - #each_cons: Calls the block with successive overlapping slices.
* (different from #each_slice).
* - #reverse_each: Calls the block with each successive element, in reverse order.
*
* === Other Methods
*
* #map, #collect:: Returns objects returned by the block.
* #filter_map:: Returns truthy objects returned by the block.
* #flat_map, #collect_concat:: Returns flattened objects returned by the block.
* #grep:: Returns elements selected by a given object
* or objects returned by a given block.
* #grep_v:: Returns elements selected by a given object
* or objects returned by a given block.
* #reduce, #inject:: Returns the object formed by combining all elements.
* #sum:: Returns the sum of the elements, using method +++.
* #zip:: Combines each element with elements from other enumerables;
* returns the n-tuples or calls the block with each.
* #cycle:: Calls the block with each element, cycling repeatedly.
* - #map, #collect: Returns objects returned by the block.
* - #filter_map: Returns truthy objects returned by the block.
* - #flat_map, #collect_concat: Returns flattened objects returned by the block.
* - #grep: Returns elements selected by a given object
* or objects returned by a given block.
* - #grep_v: Returns elements selected by a given object
* or objects returned by a given block.
* - #reduce, #inject: Returns the object formed by combining all elements.
* - #sum: Returns the sum of the elements, using method +++.
* - #zip: Combines each element with elements from other enumerables;
* returns the n-tuples or calls the block with each.
* - #cycle: Calls the block with each element, cycling repeatedly.
*
* == Usage
*

Просмотреть файл

@ -1,5 +1,3 @@
# for pack.c
class Array
# call-seq:
# arr.pack( aTemplateString ) -> aBinaryString