From: MonkeeSage Date: 2006-10-01T15:05:09+09:00 Subject: Re: New magical version of Symbol.to_proc Seth Thomas Rasmussen wrote: > On the topic at hand, I don't like the plurals option. The > Symbol#to_proc style currently in ActiveSupport seems just about > perfect to me, although I don't see why it couldn't just be: > > foos.map :bar It can... class Array def map(sym=nil, &block) self.inject([]) { |col, item| if block_given? col << block.call(item) elsif not sym.nil? col << item.send(sym) else col << item end } end def map!(sym=nil, &block) self.replace(map(sym, &block)) end end Regards, Jordan