Issue #13562 has been reported by shan (Shannon Skipper).

----------------------------------------
Feature #13562: Use a sized enumerator with #yield_self
https://bugs.ruby-lang.org/issues/13562

* Author: shan (Shannon Skipper)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
The #yield_self Enumerator instance always has a #count of `1`. I think it might be nice to provide a lazy #size of `1` to match the #count for parity.

Currently:

~~~ ruby
42.yield_self.count #=> 1
42.yield_self.size #=> nil
~~~

I propose:

~~~ ruby
42.yield_self.count #=> 1
42.yield_self.size #=> 1
~~~




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>