From: Yossef Mendelssohn Date: 2007-11-25T15:28:26+09:00 Subject: Re: Enumerable#detect_result ? On Nov 25, 12:00 am, Trans wrote: > On Nov 24, 5:12 pm, Yossef Mendelssohn 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