Sha256: 3b949423140d0946611d98e4616480b8bc141961bbd0fedcfe5d54d0a6f5d0e0

Contents?: true

Size: 394 Bytes

Versions: 9

Compression:

Stored size: 394 Bytes

Contents

class Hash
  # Hash#deep_symbolize_keys 
  # based on
  # https://github.com/svenfuchs/i18n/blob/master/lib/i18n/core_ext/hash.rb
  def deep_symbolize_keys
    inject({}) { |result, (key, value)|
      value = value.deep_symbolize_keys if value.is_a?(self.class)
      result[(key.to_sym rescue key) || key] = value
      result
    }
  end unless self.method_defined?(:deep_symbolize_keys)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
a9n-0.2.0 lib/a9n/core_ext/hash.rb
a9n-0.1.3 lib/a9n/core_ext/hash.rb
a9n-0.1.2 lib/a9n/core_ext/hash.rb
a9n-0.1.1 lib/a9n/core_ext/hash.rb
a9n-0.1.0 lib/a9n/core_ext/hash.rb
a9n-0.0.9 lib/a9n/core_ext/hash.rb
a9n-0.0.8 lib/a9n/core_ext/hash.rb
a9n-0.0.7 lib/a9n/core_ext/hash.rb
a9n-0.0.6 lib/a9n/core_ext/hash.rb