From: nobu@... Date: 2020-02-13T09:06:20+00:00 Subject: [ruby-core:97153] [Ruby master Feature#15236] add support for hash shorthand Issue #15236 has been updated by nobu (Nobuyoshi Nakada). joallard (Jonathan Allard) wrote in #note-20: > ```ruby > User.new({id, age, name, registered_at}) > ``` Note that you will have to put `**` between the parenthesis and brace now. ```ruby User.new(**{id, age, name, registered_at}) ``` ---------------------------------------- Feature #15236: add support for hash shorthand https://bugs.ruby-lang.org/issues/15236#change-84256 * Author: ignatiusreza (Ignatius Reza Lesmana) * Status: Rejected * Priority: Normal ---------------------------------------- PR in github: https://github.com/ruby/ruby/pull/1990 inspired by javascript support for object literal shorthand notation `{ a }`, which will be expanded into `{ a: a }`.. to avoid ambiguity, this shorthand is only supported when hash is defined with `{ }` notation.. in other situation where the brackets is optional, e.g. function call, we still need to write it in full (`m(a : a)` instead of `m(a)`, or `m(a, b, c: c)` instead of `m(a, b, c)`.. -- https://bugs.ruby-lang.org/ Unsubscribe: