method

deep_transform_values

Importance_1
v6.1.7.7 - Show latest stable - 0 notes - Class: Hash
deep_transform_values(&block) public

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"}}
Show source
Register or log in to add new notes.