< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #7394 has been updated by ioquatix (Samuel Williams).
Can we merge this?
----------------------------------------
Feature #7394: Enumerable#find ifnone parameter could be non-callable
https://bugs.ruby-lang.org/issues/7394#change-76793
* Author: zzak (Zachary Scott)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version:
----------------------------------------
=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
---Files--------------------------------
enumerable_find_noncallable.patch (3.45 KB)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>