From: Rick DeNatale Date: 2009-05-15T23:37:22+09:00 Subject: Re: enumerable-extra 0.1.0 On Thu, May 14, 2009 at 1:39 PM, Daniel Berger wrote: > > > On May 14, 11:30 am, Joshua Collins wrote: >> Would this be usable with a RoR app? >> >> I am not certain if RoR core needs Symbol#to_proc ... but, it would be nice >> to use enumerable-extra in my Ruby coding in RoR. I am just iffy about >> trying it cause I am not certain if I would break my RoR app because I >> installed the gem and the gem overirides Enumberable#map and so forth. >> >> Thanks :) >> >> Sorry if it seems like a newb question, but I am learning both Ruby and RoR >> at the same time -- so, in a sense I am a newb :-P > > It might, I haven't tried. It might depend on the order of your > require statements, too, because I haven't looked at their > implementation. > > The best way to find out is to run your tests. I'm curious about the > results myself. > > Note that, with no arguments it works the same as the standard MRI > version, so you can still do this: > > array.map{ |e| e.capitalize } There SHOULDN'T be a conflict since Rails/ActiveSupport doesn't change the map method it only adds a to_proc method to Symbol. require 'rubygems' require 'activesupport' require 'enumerable/extra' p %w{a b c}.map(:upcase) p %w{a b c}.map(&:upcase) # => p %w{a b c}.map(:upcase, &:downcase) ["A", "B", "C"] ["A", "B", "C"] ["a", "b", "c"] Now whether or not combining these is a good idea, I don't know. -- 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