From: shevegen@... Date: 2014-05-19T16:43:49+00:00 Subject: [ruby-core:62678] [ruby-trunk - Feature #9853] [Open] Please consider quoted generation of hash like in %h( foo bar bee blaa ) Issue #9853 has been reported by Robert A. Heiler. ---------------------------------------- Feature #9853: Please consider quoted generation of hash like in %h( foo bar bee blaa ) https://bugs.ruby-lang.org/issues/9853 * Author: Robert A. Heiler * Status: Open * Priority: Low * Assignee: * Category: * Target version: ---------------------------------------- Hi. In Ruby we can do this: %w( foo bar bee blaa ) # => ["foo", "bar", "bee", "blaa"] Ok makes an array of strings. We can do this: %i( foo bar bee blaa ) # => [:foo, :bar, :bee, :blaa] Ok, makes an array of symbols. We can also use [] on class Hash to generate a hash: Hash[*%w( foo bar bee blaa )] # => {"foo"=>"bar", "bee"=>"blaa"} My question: Would it be possible to add %h() ? It would create a hash: %h( foo bar bee blaa ) # => {"foo"=>"bar", "bee"=>"blaa"} And would raise if odd number of arguments would be supplied. -- https://bugs.ruby-lang.org/