https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17097754782014-03-13T12:59:16ZRuby Issue Tracking SystemRuby master - Feature #9635: Map a hash directly to a hashhttps://bugs.ruby-lang.org/issues/9635?journal_id=457582014-03-13T12:59:16Zlolmaus (Andrey Mikhaylov)lolmaus@gmail.com
<ul></ul><p>Ok, what i suggest is not a valid Ruby syntax. It should be</p>
<pre><code>.hashy_map { |key, value| {key => value} }
</code></pre>
<p>which is hardly sweeter than</p>
<pre><code>.map { |key, value| [key, value] }.to_h
</code></pre>
<p>and also goes against common practice of returning multiple results in an array.</p>
<p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/269">@apeiros (Stefan Rusterholz)</a> from irc://irc.freenode.net/ruby/ has cleared this out to me and suggested this very compact and efficient implementation: <a href="https://gist.github.com/apeiros/9527275" class="external">https://gist.github.com/apeiros/9527275</a></p> Ruby master - Feature #9635: Map a hash directly to a hashhttps://bugs.ruby-lang.org/issues/9635?journal_id=457592014-03-13T13:29:51Zphluid61 (Matthew Kerwin)matthew@kerwin.net.au
<ul></ul><p>At the risk of being terse, <a href="https://bugs.ruby-lang.org/issues/7793" class="external">https://bugs.ruby-lang.org/issues/7793</a></p> Ruby master - Feature #9635: Map a hash directly to a hashhttps://bugs.ruby-lang.org/issues/9635?journal_id=593052016-06-22T00:15:04Zshyouhei (Shyouhei Urabe)shyouhei@ruby-lang.org
<ul><li><strong>Related to</strong> <i><a class="issue tracker-2 status-5 priority-4 priority-default closed" href="/issues/12512">Feature #12512</a>: Import Hash#transform_values and its destructive version from ActiveSupport</i> added</li></ul> Ruby master - Feature #9635: Map a hash directly to a hashhttps://bugs.ruby-lang.org/issues/9635?journal_id=940482021-10-06T20:43:55Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul>