On 7/8/09, Max Williams <toastkid.williams / gmail.com> wrote:
> Thanks guys.
>
> I would automatically shy away from overriding to_proc as it seems like
> the sort of thing that would slip a timebomb under my app :)
>
> I was just wondering if it was possible as is, not because it's soooo
> much work to write out a proper block, but simply out of curiosity.  "No
> you can't" is a good enough answer for me.
>
> What got me wondering actually was using a Ramaze based framework and
> missing lots of nice ways that rails extends the core ruby classes (with
> Symbol#to_proc being an example).  Is it easy to just require all of
> these gems/modules and get the same stuff back?  I guess i should answer
> my own question by just trying it, so feel free to just say "why not try
> it and see?". :)
>
I am sharing your laziness ;) and you might want to check out Labrador
http://rubyforge.org/frs/?group_id=3D3824&release_id=3D33008 which will
allow you to do things like:

irb(main):001:0> %w{ a,b c,d e,f }.map( :split, "," )
=3D> [["a", "b"], ["c", "d"], ["e", "f"]]

They idea was not to change #to_proc but to enhance the Enumerable behavior=
.
But please be warned about Labrador it is not actively maintained.
However you might find some inspiration in the source.

Maybe Facets does some of the things you want, it is a very stable package.
http://facets.rubyforge.org/

HTH
Robert

--=20
Toutes les grandes personnes ont d=92abord =E9t=E9 des enfants, mais peu
d=92entre elles s=92en souviennent.

All adults have been children first, but not many remember.

[Antoine de Saint-Exup=E9ry]