Class: HashTransformer
- Inherits:
-
Object
- Object
- HashTransformer
- Extended by:
- T::Sig
- Defined in:
- lib/sorbet-schema/hash_transformer.rb
Overview
We don’t want a dependency on ActiveSupport. This is a simplified version of ActiveSupport’s Key Hash extension github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/hash/keys.rb
Class Method Summary collapse
Class Method Details
.serialize_values(hash) ⇒ Object
18 19 20 21 22 |
# File 'lib/sorbet-schema/hash_transformer.rb', line 18 def serialize_values(hash) hash.each_with_object({}) do |(key, value), result| result[key] = SerializeValue.serialize(value) end end |
.symbolize_keys(hash) ⇒ Object
11 12 13 14 15 |
# File 'lib/sorbet-schema/hash_transformer.rb', line 11 def symbolize_keys(hash) hash.each_with_object({}) do |(key, value), result| result[key.to_sym] = value end end |