From: 6ftdan@... Date: 2015-12-15T21:48:50+00:00 Subject: [ruby-core:72163] [Ruby trunk - Feature #11824] Add Enumerator#to_ary for added implicit behavior Issue #11824 has been updated by Daniel P. Clark. Other than syntactic cleanliness and possible public opinion, no I don't have a compelling reason why things would have changed. I think what I'd really like is to not have to call `to_a` on Enumerators for anything actionable (any verbs). I think you're right it may be a bad idea as many systems may have issue with this. I suppose I could write my own custom class EnumArraytors ;-). It's probably best practice to create new classes rather than change how the language itself fundamentally works. Or I could use a Refinement to do this in my own projects whenever I want to clean the code base up. Thanks for at least giving me an opportunity to defend the idea. It was worth considering the options available. ---------------------------------------- Feature #11824: Add Enumerator#to_ary for added implicit behavior https://bugs.ruby-lang.org/issues/11824#change-55574 * Author: Daniel P. Clark * Status: Feedback * 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/