From: "nobu (Nobuyoshi Nakada) via ruby-core" Date: 2023-04-19T00:34:06+00:00 Subject: [ruby-core:113296] [Ruby master Feature#19607] Introduce `Hash#symbolize_keys`. Issue #19607 has been updated by nobu (Nobuyoshi Nakada). ioquatix (Samuel Williams) wrote in #note-5: > https://github.com/search?q=repo%3Arails%2Frails%20symbolize_keys&type=code Of course it's imaginable that method is used in Rails since ActiveSupport implements it. My question is that "is it needed frequently without Rails/ActiveSupport?". > https://github.com/search?q=.symbolize_keys&type=code They are not copies? ---------------------------------------- Feature #19607: Introduce `Hash#symbolize_keys`. https://bugs.ruby-lang.org/issues/19607#change-102856 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal ---------------------------------------- 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. -- 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/