diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-09-02 13:22:26 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-09-03 11:30:49 -0700 |
commit | a7d7a0df91805e59fe6b383ea7ecdad509222966 (patch) | |
tree | 2732b61d102fa75d78a3271c83b4eedd91a0f1c0 /version.h | |
parent | 4a3972c2612c3e3695d7f67b096b2ef8cbb6649a (diff) | |
download | ruby-a7d7a0df91805e59fe6b383ea7ecdad509222966.tar.gz |
Fix Enumerator::Lazy#{to_enum,enum_for} where method is defined in Lazy
Previously, passing to_enum/enum_for a method that was defined in
Lazy itself returned wrong results:
[1,2,3].to_enum(:map).to_a
# => [1, 2, 3]
[1,2,3].lazy.to_enum(:map).to_a
# => []
I'm not sure why methods that are designed to be lazy do not work
with to_enum/enum_for. However, one possible way to work around
this bug is to have to_enum/enum_for use the implementation found
in Enumerable/Enumerator, which is what this commit does.
While this commit works around the problem, it is a band-aid, not a
real fix. It doesn't handle aliases of Enumerable::Lazy methods,
for instance. A better fix would be appreciated.
Diffstat (limited to 'version.h')
0 files changed, 0 insertions, 0 deletions