class Hash(K, V)
- Hash(K, V)
- Reference
- Object
Overview
From Rails https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/deep_transform_values.rb
Included Modules
- Enumerable({K, V})
- Iterable({K, V})
Defined in:
core_ext/hash/deep_transform_values.crInstance Method Summary
-
#deep_transform_values(&block : V -> _)
Returns a new hash with all values converted by the block operation.
-
#deep_transform_values!(&block : V -> V)
Destructively converts all values by using the block operation.
Instance Method Detail
def deep_transform_values(&block : V -> _)
#
Returns a new hash with all values converted by the block operation. This includes the values from the root hash and from all nested hashes and arrays.
hash = { person: { name: 'Rob', age: '28' } }
hash.deep_transform_values{ |value| value.to_s.upcase }
=> {person: {name: "ROB", age: "28"}}
def deep_transform_values!(&block : V -> V)
#
Destructively converts all values by using the block operation. This includes the values from the root hash and from all nested hashes and arrays.