From: Rick DeNatale Date: 2008-07-11T07:36:56+09:00 Subject: Re: Map with &:method_name ------=_Part_16089_18752710.1215729660810 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, Jul 10, 2008 at 5:22 PM, ara.t.howard wrote: > > On Jul 10, 2008, at 3:11 PM, Oliver Saunders wrote: > > I see this a lot but it doesn't work for me in IRB. Is a gem required or >> something? >> >> [1,2,3].map(&:to_s) >>>> >>> TypeError: wrong argument type Symbol (expected Proc) >> from (irb):2 >> > > > it's rails - basically > > > class Symbol > def to_proc > sym = self > lambda{|obj| obj.send sym} > end > end > And it's been picked up in Ruby 1.9, and maybe 1.8.7 as well since the current draft of the Pickaxe 3rd ed doesn't label it as 1.9 only. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ ------=_Part_16089_18752710.1215729660810--