Project

General

Profile

Actions

Feature #19607

open

Introduce `Hash#symbolize_keys`.

Added by ioquatix (Samuel Williams) about 1 year ago. Updated about 1 year ago.

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

Description

This is a very common operation.

It can currently be implemented using Hash#transform_keys(&:to_sym).

It's currently provided by Rails as Hash#symbolize_keys and Hash#symbolize_keys!.

Proposed implementation is identical to Rails implementation: https://github.com/rails/rails/blob/539144d2d61770dab66c8643e744441e52538e09/activesupport/lib/active_support/core_ext/hash/keys.rb#L20-L37

For completeness we could also consider adding stringify_keys but I think that's less frequently used.

Actions

Also available in: Atom PDF

Like1
Like0Like0Like0Like1Like0Like0Like0Like1