From: Tyler Benster Date: 2011-01-11T12:06:20+09:00 Subject: [ruby-core:34322] [Ruby 1.9-Bug#4259][Open] Symbol syntactic sugar in Hashes does not work with quotes Bug #4259: Symbol syntactic sugar in Hashes does not work with quotes http://redmine.ruby-lang.org/issues/show/4259 Author: Tyler Benster Status: Open, Priority: Low Target version: 1.9.2 ruby -v: ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0] To reproduce the problem, try the following in irb: >> hash = {Alabama: "AL"} => {:Alabama=>"AL"} >> puts hash[:"Alabama"] AL => nil >> hash2 = {"Rhode Island": "RI"} SyntaxError: (irb):3: syntax error, unexpected ':', expecting tASSOC hash2 = {"Rhode Island": "RI"} ^ (irb):3: syntax error, unexpected '}', expecting $end from /usr/local/bin/irb:12:in `
' >> hash2 = {:"Rhode Island" => "RI"} => {:"Rhode Island"=>"RI"} ---------------------------------------- http://redmine.ruby-lang.org