diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-10-22 22:42:58 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-10-22 22:42:58 +0300 |
commit | ec748a8f195cb206ad78962a99ad91f81b70b9bb (patch) | |
tree | 11ca52847ad2b944c77ed56b4dd87a91ba0e4f34 /lib | |
parent | a4b8e22f936d97eb4af7433a0c0a0d9990940400 (diff) | |
parent | e3ca493876ab71ed29817a0af436fc563f564bbe (diff) |
Merge branch '51716-add-kubernetes-namespace-model' into 'master'
Add Clusters::KubernetesNamespace model
See merge request gitlab-org/gitlab-ce!22404
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/namespace_sanitizer.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/namespace_sanitizer.rb b/lib/gitlab/namespace_sanitizer.rb new file mode 100644 index 00000000000..d755bbbcaf9 --- /dev/null +++ b/lib/gitlab/namespace_sanitizer.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Gitlab + class NamespaceSanitizer + def self.sanitize(namespace) + namespace.gsub(/[^-a-z0-9]/, '-').gsub(/^-+/, '') + end + end +end |