Feature #13562
closedUse a sized enumerator with #yield_self
Description
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:
42.yield_self.count #=> 1
42.yield_self.size #=> nil
I propose:
42.yield_self.count #=> 1
42.yield_self.size #=> 1
Updated by shan (Shannon Skipper) almost 7 years ago
I'm not at all sure about my implementation, but here is a pull request with my attempt: https://github.com/ruby/ruby/pull/1615
Updated by shyouhei (Shyouhei Urabe) almost 7 years ago
The patch seems okay to me, but honestly I don't see any practical use case of it. Do you nedd this?
Updated by Hanmac (Hans Mackowiak) almost 7 years ago
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
Updated by shyouhei (Shyouhei Urabe) almost 7 years ago
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.
Updated by shyouhei (Shyouhei Urabe) almost 7 years ago
- Status changed from Open to Closed