Project

General

Profile

Actions

Feature #17950

open

Unable to pattern-match against a String key

Added by chucke (Tiago Cardoso) over 3 years ago. Updated over 3 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:104246]

Description

I'm unable to parse against an internal hash, when the internal hash contains strings as keys:

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:

h = {"content-type" => "application/json"}
case {status: 200, headers: {"content-type" => "application/json"}, body: "bla"}
in { status: , headers: ^h, body: }
Actions

Also available in: Atom PDF

Like0
Like0Like0