ruby-changes:36976
From: nobu <ko1@a...>
Date: Mon, 29 Dec 2014 14:29:35 +0900 (JST)
Subject: [ruby-changes:36976] nobu:r49057 (trunk): literals.rdoc: quoted symbol keys
nobu 2014-12-29 14:29:28 +0900 (Mon, 29 Dec 2014) New Revision: 49057 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49057 Log: literals.rdoc: quoted symbol keys * doc/syntax/literals.rdoc (Hashes): describe about quoted symbol keys. [ci skip] Modified files: trunk/doc/syntax/literals.rdoc Index: doc/syntax/literals.rdoc =================================================================== --- doc/syntax/literals.rdoc (revision 49056) +++ doc/syntax/literals.rdoc (revision 49057) @@ -233,6 +233,14 @@ You can create a hash using symbol keys https://github.com/ruby/ruby/blob/trunk/doc/syntax/literals.rdoc#L233 This same syntax is used for keyword arguments for a method. +Like Symbol literals, you can qoute symbol keys. + + { "a 1": 1, "b #{1 + 1}": 2 } + +is equal to + + { :"a 1" => 1, :"b 2" => 2 } + See Hash for the methods you may use with a hash. == Ranges -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/