Enhanced RDoc for Enumerable (#5393)

A little more about the classes that include or extend Enumerable.
This commit is contained in:
Burdette Lamar 2022-01-04 18:39:07 -06:00 committed by GitHub
parent d5836db1b3
commit 6326112e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2022-01-05 09:39:32 +09:00
Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>

22
enum.c
View File

@ -4777,26 +4777,42 @@ enum_compact(VALUE obj)
* [1, 2]
* nil
*
* == \Enumerable in Ruby Core Classes
* Some Ruby classes include \Enumerable:
* == \Enumerable in Ruby Classes
*
* These Ruby core classes include (or extend) \Enumerable:
*
* - ARGF
* - Array
* - Dir
* - Enumerator
* - ENV (extends)
* - Hash
* - IO
* - Range
* - Set
* - Struct
*
* These Ruby standard library classes include \Enumerable:
*
* - CSV
* - CSV::Table
* - CSV::Row
* - Set
*
* Virtually all methods in \Enumerable call method +#each+ in the including class:
*
* - <tt>Hash#each</tt> yields the next key-value pair as a 2-element \Array.
* - <tt>Struct#each</tt> yields the next name-value pair as a 2-element \Array.
* - For the other classes above, +#each+ yields the next object from the collection.
*
* == About the Examples
*
* The example code snippets for the \Enumerable methods:
*
* - Always show the use of one or more \Array-like classes (often \Array itself).
* - Sometimes show the use of a \Hash-like class.
* For some methods, though, the usage would not make sense,
* and so it is not shown. Example: #tally would find exactly one of each \Hash entry.
*
*/
void