Welcome to mirror list, hosted at ThFree Co, Russian Federation.

namespace_name_validator.rb « validators « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fb1c241037ceeb203edffae120c3591d7e4bea72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# frozen_string_literal: true

# NamespaceNameValidator
#
# Custom validator for GitLab namespace name strings.
class NamespaceNameValidator < ActiveModel::EachValidator
  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
end