From: merch-redmine@... Date: 2021-06-14T23:21:44+00:00 Subject: [ruby-core:104262] [Ruby master Feature#17950] Unable to pattern-match against a String key Issue #17950 has been updated by jeremyevans0 (Jeremy Evans). Backport deleted (2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN) ruby -v deleted (3.0.1) Tracker changed from Bug to Feature The fact that only symbol keys are supported is documented (https://docs.ruby-lang.org/en/master/doc/syntax/pattern_matching_rdoc.html#label-Patterns), so this is expected and not a bug. Switching to feature request. ---------------------------------------- Feature #17950: Unable to pattern-match against a String key https://bugs.ruby-lang.org/issues/17950#change-92472 * Author: chucke (Tiago Cardoso) * Status: Open * Priority: Normal ---------------------------------------- I'm unable to parse against an internal hash, when the internal hash contains strings as keys: ```ruby case {status: 200, headers: {"content-type" => "application/json"}, body: "bla"} in { status: , headers: {"content-type" => type}, body: } # syntax error, unexpected terminator, expecting literal content or tSTRING_DBEG or tSTRING_DVAR or tLABEL_END # ...tus: , headers: {"content-type" => type}, body: } ``` however, this works: ```ruby h = {"content-type" => "application/json"} case {status: 200, headers: {"content-type" => "application/json"}, body: "bla"} in { status: , headers: ^h, body: } ``` -- https://bugs.ruby-lang.org/ Unsubscribe: