def deep_set(settings, *keys)
      return settings if keys.empty?
      key, *rest = *keys
      value = settings[key]

      if value.nil? && rest.empty?
        settings[key] = {}
      elsif value.nil? && !rest.empty?
        settings[key] = {}
        deep_set(settings[key], *rest)
      else # nested hash value present
        settings[key] = value
        deep_set(settings[key], *rest)
      end
    end
def deep_set(settings, *keys)
      return settings if keys.empty?
      key, *rest = *keys
      value = settings[key]

      if value.nil? && rest.empty?
        settings[key] = {}
      elsif value.nil? && !rest.empty?
        settings[key] = {}
        deep_set(settings[key], *rest)
      else # nested hash value present
        settings[key] = value
        deep_set(settings[key], *rest)
      end
    end
Set value under deeply nested keys

 The scan starts with the top level key and follows
 a sequence of keys. In case where intermediate keys do
 not exist, a new hash is created.

 @param [Hash] settings

 @param [Array[Object]]
   the keys to nest

 @api private