From: kachick1@... Date: 2017-11-05T17:05:30+00:00 Subject: [ruby-core:83680] [Ruby trunk Bug#14082] Enumerator#size from Enumerable#cycle returns 0 when the object is empty Issue #14082 has been reported by kachick (Kenichi Kamiya). ---------------------------------------- Bug #14082: Enumerator#size from Enumerable#cycle returns 0 when the object is empty https://bugs.ruby-lang.org/issues/14082 * Author: kachick (Kenichi Kamiya) * Status: Open * Priority: Normal * Assignee: * 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: