https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112014-01-03T11:38:07ZRuby Issue Tracking SystemRuby master - Feature #9347: Accept non callable argument to detecthttps://redmine.ruby-lang.org/issues/9347?journal_id=440412014-01-03T11:38:07Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul></ul><p>I am afraid that kind of conditional behavior could error prone (e.g. accidental misbehavior when one forget having #call in argument object). I'd rather have #detect with keyword argument, like ary.detect(ifnone: :notfound).</p>
<p>Matz.</p> Ruby master - Feature #9347: Accept non callable argument to detecthttps://redmine.ruby-lang.org/issues/9347?journal_id=440432014-01-03T13:23:19Zfuadksd (Fuad Saud)fuadksd@gmail.com
<ul></ul><p>I think, if it was possible, a call like this <code>ary.detect(:sym)</code> would make more sense by using case equality for comparison instead of #call. It would be useful with regexes for example. There's a ticket proposing this but I can't seem to find it.</p> Ruby master - Feature #9347: Accept non callable argument to detecthttps://redmine.ruby-lang.org/issues/9347?journal_id=458642014-03-18T20:50:22Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>Assignee</strong> changed from <i>matz (Yukihiro Matsumoto)</i> to <i>marcandre (Marc-Andre Lafortune)</i></li></ul><p>I agree, an optional argument would be best. I'll propose a patch. Could we use <code>if_none</code> though?</p> Ruby master - Feature #9347: Accept non callable argument to detecthttps://redmine.ruby-lang.org/issues/9347?journal_id=458652014-03-19T01:41:25Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>[GH-561] <a href="https://github.com/ruby/ruby/pull/561" class="external">https://github.com/ruby/ruby/pull/561</a> ?</p> Ruby master - Feature #9347: Accept non callable argument to detecthttps://redmine.ruby-lang.org/issues/9347?journal_id=692582018-01-05T21:00:25Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Target version</strong> deleted (<del><i>2.2.0</i></del>)</li></ul>