Sha256: 1eefe4ef86084f772cddfc80184358b7992c7e33a9945d21c71f380e83a087a7

Contents?: true

Size: 421 Bytes

Versions: 17

Compression:

Stored size: 421 Bytes

Contents

# Collection of utility methods for the Hash object
class HashUtil
  
  # Returns a hash with the keys converted to symbols
  def self.deep_symbolize_keys(hash)
    hash.keys.each do |key|
      value = hash[key]
      hash.delete(key)
      hash[key.to_sym] = value
      if hash[key.to_sym].instance_of? Hash
        hash[key.to_sym] = HashUtil.deep_symbolize_keys(hash[key.to_sym])
      end
    end
    hash
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
cobweb-0.0.73 lib/hash_util.rb
cobweb-0.0.72 lib/hash_util.rb
cobweb-0.0.71 lib/hash_util.rb
cobweb-0.0.70 lib/hash_util.rb
cobweb-0.0.68 lib/hash_util.rb
cobweb-0.0.67 lib/hash_util.rb
cobweb-0.0.66 lib/hash_util.rb
cobweb-0.0.65 lib/hash_util.rb
cobweb-0.0.64 lib/hash_util.rb
cobweb-0.0.63 lib/hash_util.rb
cobweb-0.0.62 lib/hash_util.rb
cobweb-0.0.61 lib/hash_util.rb
cobweb-0.0.60 lib/hash_util.rb
cobweb-0.0.59 lib/hash_util.rb
cobweb-0.0.58 lib/hash_util.rb
cobweb-0.0.57 lib/hash_util.rb
cobweb-0.0.55 lib/hash_util.rb