class Representable::Hash::Conversion

Public Class Methods

stringify_keys(hash) click to toggle source

DISCUSS: we could think about mixin in IndifferentAccess here (either hashie or ActiveSupport). or decorating the hash.

# File lib/representable/hash/allow_symbols.rb, line 17
def self.stringify_keys(hash)
  hash = hash.dup

  hash.keys.each do |k|
    hash[k.to_s] = hash.delete(k)
  end
  hash
end