From: 6ftdan@... Date: 2015-12-15T20:44:55+00:00 Subject: [ruby-core:72161] [Ruby trunk - Feature #11824] Add Enumerator#to_ary for added implicit behavior Issue #11824 has been updated by Daniel P. Clark. According to Matz about 6 years ago this didn't seem the right thing to do. > Hi, > In message "Re: [Bug #1893] Recursive Enumerable#join is surprising" > on Wed, 3 Mar 2010 00:57:26 +0900, Yusuke Endoh redmine@ruby-lang.org writes: > |I guess adding Enumerator#to_ary is a right solution. > I don't think so, supplying to_ary means that object can be considered > as an array, which is not always the case. > matz. https://bugs.ruby-lang.org/issues/1893#note-7 Perhaps things have changed since Ruby 1.9.2 on this issue? ---------------------------------------- Feature #11824: Add Enumerator#to_ary for added implicit behavior https://bugs.ruby-lang.org/issues/11824#change-55572 * Author: Daniel P. Clark * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Calling `Enumerator#to_a` many times can become a bit ugly in a code base. I propose these changes to Enumerator to allow implicit Array use of all Enumerators. ~~~ruby class Enumerator def to_ary to_a end def method_missing m, *a, &b return to_a.send(m, *a, &b) if Array.instance_methods.include? m super end end ~~~ -- https://bugs.ruby-lang.org/