Sha256: d201bb4bb731de7f033af28edc83734965b62602b99a4b6f4ea40a6d0a231839

Contents?: true

Size: 1.86 KB

Versions: 1

Compression:

Stored size: 1.86 KB

Contents

= Description
   This library includes modified versions of the Enumerable methods, designed
   to make list comprehensions a little bit easier and prettier in Ruby.

= Installation
   rake test (optional)
   rake install (non-gem) OR rake install_gem (gem)

= Synopsis
   require 'enumerable/extra'

   array = %w/foo bar baz/

   array.map(:upcase) => ['FOO', 'BAR', 'BAZ']
   array.map(:+, 'A') => ['fooA', 'barA', 'bazA']

   numbers = [1,2,3]
   numbers.sum => 6

= Motivation
   This library was created in reaction to the ugly "&" (or worse, "&its")
   notation started by Ruby on Rails and perpetuated by the Symbol#to_proc
   adherents.

   The theory behind Symbol#to_proc is that it's a generic metaprogramming
   solution that will solve a certain range of programming problems. The
   reality is that 99% of people use it for list comprehensions*. So, instead
   of introducing crappy notation, I decided that it made better sense to
   modify Enumerable methods to accept arguments.

   There are two advantages to this. First, superior notation, i.e. no need
   for the ampersand. One of the reasons I chose Ruby as my primary programming
   language in the first place was the beauty of its notation. I don't want
   to see that ruined by Symbol#to_proc. Also, coming from a C background, I
   find the ampersand too reminiscent of C address notation.

   Second, Symbol#to_proc is very slow.

   * Based on the questions and solutions that I see on the ruby-talk and rails
     mailing lists. I've monitored the former for almost seven years and the
     latter for close to two now. This is in addition to many blogs I read that
     occasionally touch on the subject.

= Future Plans
   Modify several more Enumerable methods.

= License
   Ruby's

= Warranty

= Author
   Daniel J. Berger
   djberg96 at nospam at gmail dot com

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enumerable-extra-0.1.0 README