From: elia@... Date: 2019-01-14T15:45:53+00:00 Subject: [ruby-core:91083] [Ruby trunk Feature#15526] New way to destruct an object hash Issue #15526 has been updated by elia (Elia Schito). Related/duplicate https://bugs.ruby-lang.org/issues/11758 ---------------------------------------- Feature #15526: New way to destruct an object hash https://bugs.ruby-lang.org/issues/15526#change-76311 * Author: alissonbruno.sa (Alisson Santos) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- JavaScript has a nice a neat way to destruct objects. ~~~ javascript const person = { name: "John Doe", age: 33 }; const { name, age } = person; ~~~ Erlang has a similar way to destruct a tuple: ~~~ erlang Person = {"John Doe", 33} {Name, Age} = Person ~~~ I think it's very handy and would be nice if we have something similar in Ruby. ~~~ ruby config = { host: 'localhost', port: 3000 } { host, port } = config ~~~ I know Ruby has Hash#values_at, but I think this way it's more readable and understandable What do you guys think? -- 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>