From: Yukihiro Matsumoto Date: 2008-12-01T09:14:36+09:00 Subject: Re: Enumerable#select used to return actual values Hi, In message "Re: Enumerable#select used to return actual values" on Mon, 1 Dec 2008 09:01:41 +0900, Trans writes: |I take it that #each_with_object returns the accumulator, ie. | | a = (0..10).each_with_object([]) {|e,a| a << (e * e) if e > 5 } | |Since in 1.9 the block parameter is local to the block. Probably. |As for a better name, maybe #each can just take an argument. | | (0..10).each([]) {|e,a| a << (e * e) if e > 5 } | |Or there's #accumulate, although the object doesn't necessarily have |to be used according to that meaning. I prefer _with_something name to redefining each or accumulate, if possible. |Do you remain against the idea of #compact taking a block? Wow, one at a time please. matz.