Skip to content

Commit bbf8735

Browse files
committed
Add description about edge cases of Enumerable#size
[Bug #21152]
1 parent 8d21f66 commit bbf8735

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

enum.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5107,6 +5107,19 @@ enum_compact(VALUE obj)
51075107
* For some methods, though, the usage would not make sense,
51085108
* and so it is not shown. Example: #tally would find exactly one of each Hash entry.
51095109
*
5110+
* == Extended Methods
5111+
*
5112+
* A Enumerable class may define extended methods. This section describes the standard
5113+
* behavior of extension methods for reference purposes.
5114+
*
5115+
* === #size
5116+
*
5117+
* Returns the size of elements. The size is defined as the number of iterations
5118+
* the #each method would perform over the elements.
5119+
* If #each method won't finish and its elements are Numeric, the size is +Infinite+.
5120+
* If #each method won't finish and its elements are not Numeric, the size is +nil+.
5121+
* If #each method don't work fine, raise TypeError.
5122+
*
51105123
*/
51115124

51125125
void

0 commit comments

Comments
 (0)