We went down a pretty similar route (the same actually). The problem
is "proc do" or just generally having to explicitly declare a
block/proc before, which takes a lot of the beauty out of it. I think
it would be better phrased if it was simply " { " as in ButFirst.pm.

But let's keep this rolling  =)


On Wed, Mar 11, 2009 at 12:46 AM, Ian White <[email protected]> wrote:
>
>> At one stage I seriously thought about implementing ButFirst.pm in
>> Ruby. I couldn't think of a nice way that would make it work as nicely
>> as in Perl, but who knows, maybe in 1.9.
>
> How about:
>
> class Proc
>   def but_first(&block)
>     block.call
>     self.call
>   end
> end
>
> # in action:
>
> proc do
>   puts "there"
> end.but_first do
>   puts "hello"
> end
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to