Issue #8490 has been updated by matz (Yukihiro Matsumoto).

Status changed from Open to Rejected

I don't think "index" is a proper term here.  Array#index, Enumerable#find_index, Enumerable#with_index all treat "index" as an offset to an item in the enumerables.  Whereas this method (index_by) is not related to offsets.

Matz.

----------------------------------------
Feature #8490: Bring ActiveSupport Enumerable#index_by to core
https://bugs.ruby-lang.org/issues/8490#change-39704

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/