Class: Gitlab::Config::Entry::Validators::RequiredKeysValidator

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



33
34
35
36
37
38
39
40
# File 'lib/gitlab/config/entry/validators.rb', line 33

def validate_each(record, attribute, value)
  present_keys = options[:in] - value.try(:keys).to_a

  if present_keys.any?
    record.errors.add(attribute, "missing required keys: " +
      present_keys.join(', '))
  end
end