Issue #7394 has been reported by zzak (Zachary Scott).

----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394

Author: zzak (Zachary Scott)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: core
Target version: 2.0.0


=begin
from github:
https://github.com/ruby/ruby/pull/186

In trunk the Enumerable #find method ifnone parameter has to be callable or nil. I found that sometimes I want to return a simple value without wrapping it in a proc. This pull request adds support for non-callable defaults when no items match.

(({a = [1, 2, 3]}))

The current behavior
(({a.find(proc { :foo }) { |x| x > 3 } #=> :foo}))

With patch
(({a.find(0) { |x| x > 3 } #=> 0}))
=end



-- 
http://bugs.ruby-lang.org/