Class: Gitlab::Config::Entry::Validators::AllowedArrayValuesValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/gitlab/config/entry/validators.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object


51
52
53
54
55
56
57
# File 'lib/gitlab/config/entry/validators.rb', line 51

def validate_each(record, attribute, value)
  unknown_values = value - options[:in]
  unless unknown_values.empty?
    record.errors.add(attribute, "contains unknown values: " +
                                  unknown_values.join(', '))
  end
end