Class: Gitlab::Config::Entry::Validators::VariablesValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Gitlab::Config::Entry::Validators::VariablesValidator
- Includes:
- LegacyValidationHelpers
- Defined in:
- lib/gitlab/config/entry/validators.rb
Instance Method Summary collapse
- #validate_each(record, attribute, value) ⇒ Object
- #validate_key_array_values(record, attribute, value) ⇒ Object
- #validate_key_values(record, attribute, value) ⇒ Object
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
344 345 346 347 348 349 350 |
# File 'lib/gitlab/config/entry/validators.rb', line 344 def validate_each(record, attribute, value) if [:array_values] validate_key_array_values(record, attribute, value) else validate_key_values(record, attribute, value) end end |
#validate_key_array_values(record, attribute, value) ⇒ Object
358 359 360 361 362 |
# File 'lib/gitlab/config/entry/validators.rb', line 358 def validate_key_array_values(record, attribute, value) unless validate_array_value_variables(value) record.errors.add(attribute, 'should be a hash of key value pairs, value can be an array') end end |
#validate_key_values(record, attribute, value) ⇒ Object
352 353 354 355 356 |
# File 'lib/gitlab/config/entry/validators.rb', line 352 def validate_key_values(record, attribute, value) unless validate_variables(value) record.errors.add(attribute, 'should be a hash of key value pairs') end end |