From: "mame (Yusuke Endoh) via ruby-core" Date: 2023-04-14T01:16:20+00:00 Subject: [ruby-core:113232] [Ruby master Feature#19591] Add symbolize_keys to MatchData#named_captures Issue #19591 has been updated by mame (Yusuke Endoh). Discussed at the dev meeting. @matz accepted this, but he also said that the keyword should be `symbolize_names`, not `symbolize_keys`, following `JSON.parse(..., symbolize_names: true)`. ---------------------------------------- Feature #19591: Add symbolize_keys to MatchData#named_captures https://bugs.ruby-lang.org/issues/19591#change-102779 * 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_keys: 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/