[ruby-core:76923] [Ruby trunk Feature#12512] Import Hash#transform_values and its destructive version from ActiveSupport
From:
eregontp@...
Date:
2016-08-16 09:43:51 UTC
List:
ruby-core #76923
Issue #12512 has been updated by Benoit Daloze.
Yukihiro Matsumoto wrote:
> `map_values`, `map_keys` and `map_pairs` seems consistent.
>
> In addition, we are considering adding a method to create a hash from an enumerable in a similar way to `map_pairs` or `map_kv`.
What would be the semantics?
For simple cases there is already Enumerable#to_h for an enumeration of pairs:
~~~ ruby
(1..4).each_cons(2).map {|k,v| ... }.to_h
~~~
For more complex cases, would it be something like Enumerable#associate or #categorize (#4151) ?
----------------------------------------
Feature #12512: Import Hash#transform_values and its destructive version from ActiveSupport
https://bugs.ruby-lang.org/issues/12512#change-60152
* 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>