From: cardoso_tiago@... Date: 2021-06-15T11:42:31+00:00 Subject: [ruby-core:104274] [Ruby master Feature#17950] Unable to pattern-match against a String key Issue #17950 has been updated by chucke (Tiago Cardoso). > Switching to feature request. Makes sense. Hopefully the example of matching HTTP headers makes it a compelling case for such. ---------------------------------------- Feature #17950: Unable to pattern-match against a String key https://bugs.ruby-lang.org/issues/17950#change-92486 * 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>