On Nov 25, 12:00 am, Trans <transf... / gmail.com> wrote:
> 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.

Well, dang. I would say that's obvious, but if that were actually the
case I would've thought of it. Nice one.

--
-yossef