Class: NamespaceNameValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/namespace_name_validator.rb

Overview

NamespaceNameValidator

Custom validator for GitLab namespace name strings.

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object


5
6
7
8
9
# File 'app/validators/namespace_name_validator.rb', line 5

def validate_each(record, attribute, value)
  unless value =~ Gitlab::Regex.namespace_name_regex
    record.errors.add(attribute, Gitlab::Regex.namespace_name_regex_message)
  end
end