Sha256: 75879ff2871ba6a5d0387d6eb830ba0dc921d8c83c1c14be26ad6b0b5c59a689

Contents?: true

Size: 334 Bytes

Versions: 25

Compression:

Stored size: 334 Bytes

Contents

class Hash

  # Return self as symbolized keys hash
  def symbolize_keys
    self.dup.inject({}) do |hsh, (k,v)|
      hsh[k.to_s.to_sym] = (v.respond_to?(:symbolize_keys) ? v.symbolize_keys : v)
      hsh
    end
  end

  # Replace self with symbolized keys hash
  def symbolize_keys!
    self.replace(self.symbolize_keys)
  end

end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
fozzie-0.0.27 lib/core_ext/hash.rb
fozzie-0.0.26 lib/core_ext/hash.rb
fozzie-0.0.25 lib/core_ext/hash.rb
fozzie-0.0.24 lib/core_ext/hash.rb
fozzie-0.0.23 lib/core_ext/hash.rb
fozzie-0.0.22 lib/core_ext/hash.rb
fozzie-0.0.21 lib/core_ext/hash.rb
fozzie-0.0.20 lib/core_ext/hash.rb
fozzie-0.0.19 lib/core_ext/hash.rb
fozzie-0.0.18 lib/core_ext/hash.rb
fozzie-0.0.17 lib/core_ext/hash.rb
fozzie-0.0.16 lib/core_ext/hash.rb
fozzie-0.0.15 lib/core_ext/hash.rb
fozzie-0.0.14 lib/core_ext/hash.rb
fozzie-0.0.13 lib/core_ext/hash.rb
fozzie-0.0.12 lib/core_ext/hash.rb
fozzie-0.0.11 lib/core_ext/hash.rb
fozzie-0.0.10 lib/core_ext/hash.rb
fozzie-0.0.9 lib/core_ext/hash.rb
fozzie-0.0.8 lib/core_ext/hash.rb