From: naruse@... Date: 2017-04-13T07:12:42+00:00 Subject: [ruby-core:80676] [Ruby trunk Feature#13137] Hash Shorthand Issue #13137 has been updated by naruse (Yui NARUSE). Note: such culture seems to come from SGML. ---------------------------------------- Feature #13137: Hash Shorthand https://bugs.ruby-lang.org/issues/13137#change-64206 * Author: trevorlynnsmith (Trevor Smith) * Status: Rejected * Priority: Normal * Assignee: * Target version: ---------------------------------------- The ES6 update to Javascript added object shorthand. I propose that a similar hash shorthand be added to Ruby. ### Before ~~~ ruby name = 'Matz' country = 'Japan' attributes = { name: name, country: country } ~~~ ### After ~~~ ruby name = 'Matz' country = 'Japan' attributes = { name, country } ~~~ This would be very useful when building hashes from keyword arguments (especially with default values): ~~~ ruby def build(name: 'John Doe', age: 100, country: 'Earth', ) attributes = { name, age, country } end ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: