Class: Gitlab::Config::Entry::Validators::ArrayOfHashesValidator

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

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object


80
81
82
83
84
# File 'lib/gitlab/config/entry/validators.rb', line 80

def validate_each(record, attribute, value)
  unless value.is_a?(Array) && value.map { |hsh| hsh.is_a?(Hash) }.all?
    record.errors.add(attribute, 'should be an array of hashes')
  end
end