Sha256: b9815ea0633dd77a89369464638cbdb0d8df25c759d44d2539ffb27134ac4751
Contents?: true
Size: 531 Bytes
Versions: 13
Compression:
Stored size: 531 Bytes
Contents
module Grape module Extensions module DeepHashWithIndifferentAccess def self.deep_hash_with_indifferent_access(object) case object when ::Hash object.inject(::ActiveSupport::HashWithIndifferentAccess.new) do |new_hash, (key, value)| new_hash.merge!(key => deep_hash_with_indifferent_access(value)) end when ::Array object.map { |element| deep_hash_with_indifferent_access(element) } else object end end end end end
Version data entries
13 entries across 13 versions & 2 rubygems