summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authorNARUSE, Yui <[email protected]>2025-04-16 16:54:33 +0900
committerNARUSE, Yui <[email protected]>2025-04-16 16:55:38 +0900
commitbbf873521a01c1c44297b9dd52cf4e309ae5b496 (patch)
tree3af3d50c4c91bf6a4b7c746e7b628fbae811656c /enum.c
parent8d21f666b8098545a366c46f1990edf2a9f4ffcb (diff)
Add description about edge cases of Enumerable#size
[Bug #21152]
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/enum.c b/enum.c
index adaa660001..40c2fb366c 100644
--- a/enum.c
+++ b/enum.c
@@ -5107,6 +5107,19 @@ enum_compact(VALUE obj)
* 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.
*
+ * == Extended Methods
+ *
+ * A Enumerable class may define extended methods. This section describes the standard
+ * behavior of extension methods for reference purposes.
+ *
+ * === #size
+ *
+ * Returns the size of elements. The size is defined as the number of iterations
+ * the #each method would perform over the elements.
+ * If #each method won't finish and its elements are Numeric, the size is +Infinite+.
+ * If #each method won't finish and its elements are not Numeric, the size is +nil+.
+ * If #each method don't work fine, raise TypeError.
+ *
*/
void