From: "palkan (Vladimir Dementyev) via ruby-core" Date: 2023-04-15T15:00:49+00:00 Subject: [ruby-core:113263] [Ruby master Feature#19591] Add symbolize_names to MatchData#named_captures Issue #19591 has been updated by palkan (Vladimir Dementyev). mame (Yusuke Endoh) wrote in #note-2: > ... the keyword should be `symbolize_names`, not `symbolize_keys`, following `JSON.parse(..., symbolize_names: true)`. Updated in the PR ---------------------------------------- Feature #19591: Add symbolize_names to MatchData#named_captures https://bugs.ruby-lang.org/issues/19591#change-102824 * Author: palkan (Vladimir Dementyev) * Status: Open * Priority: Normal ---------------------------------------- This feature is a follow-up for MatchData#deconstruct_keys (see https://github.com/ruby/ruby/pull/6216). Example: ```ruby m = /(?.)(?.)/.match("01") # => # m.named_captures #=> {"a" => "1"} m.named_captures(symbolize_names: true) #=> {:a => "1"} ``` The underlying (C) functionality has been already implemented. The proposal is to expose it via the optional `symbolize_keys: true | false` keyword argument. PR is attached: https://github.com/ruby/ruby/pull/6952 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/