From: Rick DeNatale Date: 2009-12-11T00:22:15+09:00 Subject: [ruby-core:27128] Re: #to_enum ignores block? On Thu, Dec 10, 2009 at 9:58 AM, Roger Pack wrote: >> The whole purpose of to_enum is to return an Enumerator instance. >> The block has no meaning and is ignored, it's what the docs and source say. >> What did you expect it to do? > > I would expect it to act like a filter. >>> (1..3).to_enum {|n| n*2}.to_a > => [1, 4, 9] > > Apparently it used to do that--anybody know if it was a conscious > decision to take it out? As far as I can tell, standard Ruby Enumerable#to_enum never took a block. It's not documented to in the Ruby 1.8 documentation, and looking at the 1.8.6 implementation code, it seems to ignore any block. Perhaps you were using some non-standard extension which added this, facets perhaps? -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale