Sha256: 9d33fb431d1862ecfae18b40a2704e6cd59e917aa7c82ee8260fc92ac0b852da

Contents?: true

Size: 563 Bytes

Versions: 3

Compression:

Stored size: 563 Bytes

Contents

module IqSMS
  module Utils
    extend self

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
iqsms-0.2.2 lib/iqsms/utils.rb
iqsms-0.2.1 lib/iqsms/utils.rb
iqsms-0.2.0 lib/iqsms/utils.rb