Project

General

Profile

Actions

Feature #9853

open

Please consider quoted generation of hash like in %h( foo bar bee blaa )

Added by shevegen (Robert A. Heiler) over 10 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:62678]

Description

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.

No data to display

Actions

Also available in: Atom PDF

Like0