From d4f33feb23da2965095cf6f50a704e84873d71ab Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Mon, 21 Jul 2025 12:02:08 +0900 Subject: [PATCH] mruby-enumerator: add call-seq documentation for inspect and size methods Added missing call-seq documentation for two Enumerator methods in mrblib/enumerator.rb: ## Enumerator Instance Methods: - inspect: returns string representation of the enumerator showing the underlying object, method, and arguments in a readable debug format with examples for different enumerator types - size: returns the size of the enumerator if calculable, or nil if it cannot be determined lazily, with examples showing finite and infinite enumerators Co-authored-by: Atlassian Rovo Dev --- mrbgems/mruby-enumerator/mrblib/enumerator.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb index 470df36ec..baf0cbbe9 100644 --- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb +++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb @@ -229,6 +229,15 @@ class Enumerator object end + ## + # call-seq: + # enum.inspect -> string + # + # Returns a string representation of the enumerator. + # + # [1, 2, 3].each.inspect #=> "#" + # [1, 2, 3].map.inspect #=> "#" + # def inspect if @args && @args.size > 0 args = @args.join(", ") @@ -238,6 +247,16 @@ class Enumerator end end + ## + # call-seq: + # enum.size -> int, float, or nil + # + # Returns the size of the enumerator, or nil if it cannot be calculated lazily. + # + # [1, 2, 3].each.size #=> 3 + # (1..100).each.size #=> 100 + # loop.size #=> nil + # def size if @size @size