Lyle Johnson wrote:
> On 2/8/07, Joel VanderWerf <vjoel / path.berkeley.edu> wrote:
> 
>> Does this help?
>>
>>    class Foo
>>      def try(x, y, z)
>>        # ... do some other stuff first ...
>>        yield self if block_given?
>>      end
>>
>>      alias old_try try
>>      def try(hash)
>>        old_try(hash[:x], hash[:y], hash[:z]) do
>>          yield self if block_given?
>>        end
>>      end
>>    end
>>
>>    Foo.new.try({}) do puts "trying" end
> 
> Ah, yes, that ought to do the trick too. Thanks!

It *might* be faster, too, if that matters. It doesn't create a Proc 
instance.

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/199634

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407