Sha256: 0d0b1df4f4ae2474d58ba992f71ba4f1ea05001058300ae25b2a74924b61d2f1

Contents?: true

Size: 400 Bytes

Versions: 1

Compression:

Stored size: 400 Bytes

Contents

class Hash
  def deep_symbolize_keys
    inject({}) { |result, (key, value)|
      result[(key.to_sym rescue key) || key] = case value
      when Array
        value.map { |value| value.is_a?(Hash) ? value.deep_symbolize_keys : value }
      when Hash
        value.deep_symbolize_keys
      else
        value
      end
      result
    }
  end unless Hash.method_defined?(:deep_symbolize_keys)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 lib/core_ext/hash/deep_symbolize_keys.rb