Issue #13137 has been reported by Trevor Smith. ---------------------------------------- Feature #13137: Hash Shorthand https://bugs.ruby-lang.org/issues/13137 * Author: Trevor Smith * Status: Open * 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>