From: matz@... Date: 2017-03-13T08:14:41+00:00 Subject: [ruby-core:80111] [Ruby trunk Feature#13137][Rejected] Hash Shorthand Issue #13137 has been updated by Yukihiro Matsumoto. Status changed from Open to Rejected Rejected. I saw JavaScript new syntax, but I had no sympathy. It doesn't make anything more understandable. Matz. ---------------------------------------- Feature #13137: Hash Shorthand https://bugs.ruby-lang.org/issues/13137#change-63537 * Author: 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: