On Nov 24, 5:12 pm, Yossef Mendelssohn <ymen... / pobox.com> wrote:
> Actual code from a recent project:
>
>     # This is bunk, but I'm tired and can't think of the right way to
> do this
>     # I was trying formats.detect, but that just returns the format,
> not the result
>     result = nil
>     formats.each do |f|
>       result = f.process(mesg)
>       break if result
>     end

A little better.

     result = nil
     formats.find do |f|
       result = f.process(mesg)
     end

T.