Issue #13562 has been updated by shyouhei (Shyouhei Urabe).


Hanmac (Hans Mackowiak) wrote:
> shyouhei (Shyouhei Urabe) wrote:
> > The patch seems okay to me, but honestly I don't see any practical use case of it.  Do you nedd this?
> 
> the pr was already merged, but this ticket was not closed because of that

Thank you.  Issue updated to refer the changeset.


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

* 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>