Method: Hash#stringify_values!

Defined in:
lib/sc-core-ext/hash.rb

#stringify_values!Object

As the ActiveSupport extension #stringify_keys! except that it’s applied to values instead.



3
4
5
6
7
8
# File 'lib/sc-core-ext/hash.rb', line 3

def stringify_values!
  inject(self.class.new) do |new_hash, (key, value)|
    new_hash[key] = value.kind_of?(String) ? value : value.to_s
    new_hash
  end
end