Method: R10K::Settings::List#validate

Defined in:
lib/r10k/settings/list.rb

#validatenil, Hash

Validate all items in the list and return validation errors

Returns:

  • (nil, Hash)

    If all validation passed nil will be returned; if validation failed then a hash of those errors will be returned.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/r10k/settings/list.rb', line 54

def validate
  errors = {}

  @items.each_with_index do |item, idx|
    begin
      item.validate
    rescue => error
      errors[idx+1] = error
    end
  end

  if !errors.empty?
    raise ValidationError.new(_("Validation failed for '%{name}' settings list") % {name: @name}, :errors => errors)
  end
end