Project

General

Profile

Actions

Feature #17950

open

Unable to pattern-match against a String key

Added by chucke (Tiago Cardoso) about 1 year ago. Updated about 1 year ago.

Status:
Open
Priority:
Normal
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