Actions
Bug #14082
closedEnumerator#size from Enumerable#cycle returns 0 when the object is empty
Description
github: https://github.com/ruby/ruby/pull/1742
Is this an intentional behavior?
p([].cycle.size) #=> 0
p({}.cycle.size) #=> Infinity
Array#cycle already special handled empty arrays. So similar behavior in Enumerable#cycle with the #size sounds reasonable to me.
Updated by marcandre (Marc-Andre Lafortune) over 6 years ago
- Assignee set to marcandre (Marc-Andre Lafortune)
Good catch, great patch :-)
Updated by marcandre (Marc-Andre Lafortune) over 6 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r60666.
Fix size on Enumerable#cycle when the size is 0 [Bug #14082].
Patch by Kenichi Kamiya
Updated by marcandre (Marc-Andre Lafortune) over 6 years ago
- Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN to 2.3: REQUIRED, 2.4: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) about 6 years ago
- Backport changed from 2.3: REQUIRED, 2.4: REQUIRED to 2.3: REQUIRED, 2.4: DONE
Updated by usa (Usaku NAKAMURA) about 6 years ago
- Backport changed from 2.3: REQUIRED, 2.4: DONE to 2.3: DONE, 2.4: DONE
ruby_2_3 r62827 merged revision(s) 60666,60667,60668.
Actions
Like0
Like0Like0Like0Like0Like0