From: Robert Klemme Date: 2011-06-07T20:54:45+09:00 Subject: Re: CORE - Altering Behaviour of "each do" (default param "item") On Tue, Jun 7, 2011 at 1:26 PM, Adam Prescott wrote: > 2011/6/7 Jörg W Mittag > >> Ilias Lazaridis wrote: >> > I've just noticed repetitions within code like that: >> > >> > names.each { |name| puts name} # 3 times "name(s)" >> >> That's because nobody who knows even the tiniest bit of Ruby would >> ever write it like that. >> >>    names.each(&method(:puts)) >> >> Would probably be the most idiomatic way. >> > > That's a fairly sweeping statement. I know more than the tiniest bit of Ruby > and I prefer { |name| puts name } to &method(:puts). More than prefer, in > fact, I would never use the latter. In this case you'd probably rather want to use "puts names" and avoid explicit iteration altogether. :-) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/