Class: Gitlab::Config::Entry::Validators::NestedArrayOfHashesOrArraysValidator

Inherits:
ArrayOfHashesValidator
  • Object
show all
Includes:
NestedArrayHelpers
Defined in:
lib/gitlab/config/entry/validators.rb

Instance Method Summary collapse

Methods included from NestedArrayHelpers

#validate_nested_array

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object


107
108
109
110
111
112
113
# File 'lib/gitlab/config/entry/validators.rb', line 107

def validate_each(record, attribute, value)
  max_level = options.fetch(:max_level, 1)

  unless validate_nested_array(value, max_level, &method(:validate_hash))
    record.errors.add(attribute, 'should be an array containing hashes and arrays of hashes')
  end
end