From: Joshua Collins Date: 2009-05-15T02:30:46+09:00 Subject: Re: [ANN] enumerable-extra 0.1.0 --001e680f11440608330469e2b016 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 On Thu, May 14, 2009 at 12:08 PM, Daniel Berger wrote: > Hi, > > Convinced that Symbol#to_proc is mostly a solution in search of a problem, > I've released enumerable-extra 0.1.0. > > = What is it? > > The enumerable-extra library overrides Enumerable#map, Array#map and > Array#map to accept a method, with optional arguments, that are performed > on > every element of the list. > > For example, instead of this: > > array.map{ |e| e.capitalize } > > You can do this: > > array.map(:capitalize) # Capitalize every element > > You can also mix and match: > > array.map(:capitalize){ |e| e + 'x' } # Add 'x' after capitalizing every > element > > = Why is it better than Symbol#to_proc ? > > First, it doesn't require additional notation, i.e. no "&", no "its", no > "self" - just a method name. In my opinion, that makes the syntax cleaner. > Second, Symbol#to_proc is slow. > > = How do I get it? > > gem install enumerable-extra > > = Caveat > > This is for Ruby 1.8.x only. > > Enjoy! > > Dan > > > --001e680f11440608330469e2b016--