From: "Eregon (Benoit Daloze)" <redmine@...> Date: 2013-06-06T00:16:59+09:00 Subject: [ruby-core:55321] [ruby-trunk - Feature #8490] Bring ActiveSupport Enumerable#index_by to core Issue #8490 has been updated by Eregon (Benoit Daloze). rosenfeld (Rodrigo Rosenfeld Rosas) wrote: > if you read index as a name, then you're correct, but in index_by it is a verb, meaning that you're indexing an enumerable by something, by transforming it on a hash indexed by that something... Please reconsider. Yes, of course, but it still remains confusing and not consistent at first sight. Also, semantics are not very clear, why last instead of first if multiple by key? I do agree Hash construction from Enumerable is something to work on, but this name is definitely not the best, neither are the semantics. ---------------------------------------- Feature #8490: Bring ActiveSupport Enumerable#index_by to core https://bugs.ruby-lang.org/issues/8490#change-39726 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Rejected Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: core Target version: It seems to be a common sense to have the useful implementation of Enumerable#index_by as in ActiveSupport. index_by acts like group_by but only maps a single record, instead of an array, keeping the last match only. It's usually used in places where you shouldn't have more than a single match for each key. Would you consider its inclusion to core Enumerable module? -- http://bugs.ruby-lang.org/