Issue #12512 has been updated by Benoit Daloze.


Right, sorry for the diversion.

I agree with Marc-Andre, I do not find map_values confusing.
After all we want to take a Hash, change/map its values to something else and return the resulting Hash.

I guess matz meant hash.values.map {} but that's the reverse order of operations and naturally it ends up with a different result (take the Hash values as an Array and map it).
I do not see this as confusing.
Also there is already flat_map, collect_concat, etc which of course exist because it's not "just" a composition of the two operations mentioned in the name.

Enumerable#map_pairs sounds right if it's about manipulating pairs (2-element arrays or key-value pairs).

----------------------------------------
Feature #12512: Import Hash#transform_values and its destructive version from ActiveSupport
https://bugs.ruby-lang.org/issues/12512#change-60164

* Author: Kenta Murata
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
I think value transformation is a fundamental feature of Hash.



-- 
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>