From: ruby-core@... Date: 2017-11-05T22:12:42+00:00 Subject: [ruby-core:83682] [Ruby trunk Bug#14082] Enumerator#size from Enumerable#cycle returns 0 when the object is empty Issue #14082 has been updated by marcandre (Marc-Andre Lafortune). Assignee set to marcandre (Marc-Andre Lafortune) Good catch, great patch :-) ---------------------------------------- Bug #14082: Enumerator#size from Enumerable#cycle returns 0 when the object is empty https://bugs.ruby-lang.org/issues/14082#change-67704 * Author: kachick (Kenichi Kamiya) * Status: Open * Priority: Normal * Assignee: marcandre (Marc-Andre Lafortune) * Target version: * ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- github: https://github.com/ruby/ruby/pull/1742 Is this an intentional behavior? ```ruby 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. -- https://bugs.ruby-lang.org/ Unsubscribe: