On Nov 24, 4:12 pm, Yossef Mendelssohn <ymen... / pobox.com> wrote:

> Is there anything like Enumerable#detect_result? Is there any desire
> for it? Is there any better name?

Would this work?

module Enumerable
  def detect_result(ifnone=nil, &block)
    self.each { |x|
      result = block.call(x)
      return result if result
    }
    if ifnone
      then ifnone.call
      else nil
    end
  end
end

Regards,
Jordan