Module: IqSMS::Utils
Instance Method Summary collapse
Instance Method Details
#deeply_with_indifferent_access(hash) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/iqsms/utils.rb', line 5 def deeply_with_indifferent_access(hash) hash = ActiveSupport::HashWithIndifferentAccess.new(hash) hash.each do |key, value| if value.is_a?(Hash) hash[key] = deeply_with_indifferent_access(value) elsif value.is_a?(Array) hash[key] = value.map do |element| if element.is_a?(Hash) deeply_with_indifferent_access(element) else element end end end end hash end |