Sha256: 8c87ea30b11fb726b17ad22d6dc54ecb400a139204a4e100eb7f9b4e6c7a3686

Contents?: true

Size: 402 Bytes

Versions: 63

Compression:

Stored size: 402 Bytes

Contents

class Hash
  def deep_stringify_keys
    new_hash = {}
    self.each do |key, value|
      new_hash.merge!(key.to_s => (value.is_a?(Hash) ? value.deep_stringify_keys : value))
    end
    new_hash
  end

  def deep_symbolize_keys
    new_hash = {}
    self.each do |key, value|
      new_hash.merge!(key.to_sym => (value.is_a?(Hash) ? value.deep_symbolize_keys : value))
    end
    new_hash
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
shelly-0.0.60 lib/core_ext/hash.rb
shelly-0.0.59 lib/core_ext/hash.rb
shelly-0.0.58 lib/core_ext/hash.rb
shelly-0.0.57 lib/core_ext/hash.rb
shelly-0.0.56 lib/core_ext/hash.rb
shelly-0.0.55 lib/core_ext/hash.rb
shelly-0.0.55.pre lib/core_ext/hash.rb
shelly-0.0.54 lib/core_ext/hash.rb
shelly-0.0.53 lib/core_ext/hash.rb
shelly-0.0.52 lib/core_ext/hash.rb
shelly-0.0.51.pre lib/core_ext/hash.rb
shelly-0.0.51 lib/core_ext/hash.rb
shelly-0.0.50.pre2 lib/core_ext/hash.rb
shelly-0.0.50.pre lib/core_ext/hash.rb
shelly-0.0.50 lib/core_ext/hash.rb
shelly-0.0.49.pre lib/core_ext/hash.rb
shelly-0.0.49 lib/core_ext/hash.rb
shelly-0.0.48 lib/core_ext/hash.rb
shelly-0.0.48.pre4 lib/core_ext/hash.rb
shelly-0.0.48.pre3 lib/core_ext/hash.rb