From: "kddnewton (Kevin Newton) via ruby-core" Date: 2025-11-10T16:00:46+00:00 Subject: [ruby-core:123754] [Ruby Feature#21678] Enumerable#rfind Issue #21678 has been reported by kddnewton (Kevin Newton). ---------------------------------------- Feature #21678: Enumerable#rfind https://bugs.ruby-lang.org/issues/21678 * Author: kddnewton (Kevin Newton) * Status: Open ---------------------------------------- I'd like to introduce `rfind` to enumerable, which would effectively be the same as `reverse_each.find`. I've found myself using this a surprising number of times, and have been surprised at its omission. That means either falling back to `reverse_each` or `rindex`. For context, here are a couple of examples of this in the wild: * [pry](https://github.com/pry/pry/blob/80816f596774d00afdc81a555724b0819bf26782/lib/pry/commands/edit.rb#L213) * [bundler](https://github.com/ruby/rubygems/blob/e4fd4ee3fad005fce1dbcbeffd47e7199243bc42/bundler/lib/bundler/self_manager.rb#L146) * [textbringer](https://github.com/shugo/textbringer/blob/738d318558045efc9d978e6b5616d2641a1b1305/lib/textbringer/modes/ruby_mode.rb#L271) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/