ActionsLike0
Feature #9686
openSyntax for symbols used in hashes
Status:
Open
Assignee:
-
Target version:
-
Description
Symbols are often used literally as keys in hashes like this:
{foo: 'bar'}
But acutally there is a little inconvenience when using the alternative :"name"
literal syntax:
string = 'foo'
{:"#{string}" => 'bar'}
It would be great if Ruby provided the possibility to write the second example like this:
string = 'foo'
{"#{string}": 'bar'}
This would be logical, because you can write both syntaxes the same way when not using them in hashes.
Updated by nobu (Nobuyoshi Nakada) about 11 years ago
- Description updated (diff)
Updated by googlefeud (google feud (spammer, locked)) about 7 years ago
- Subject changed from Syntax for symbols used in hashes to google classroom
Updated by usa (Usaku NAKAMURA) about 7 years ago
- Subject changed from google classroom to Syntax for symbols used in hashes
ActionsLike0