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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario de la Ossa <mdelaossa@gitlab.com>2018-03-07 00:16:55 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-03-07 00:16:55 +0300
commitf9d61717cfa1956fd75a3c9bc4577172affd730e (patch)
tree960dea31740bb82de98b852a5c1f8f088d4d1ad4 /lib/gitlab/utils.rb
parent135ef031024ea95d3dc014c5f0ef46983372f2f3 (diff)
Gitlab::Utils - backport `.ensure_array_from_string` from EE
Diffstat (limited to 'lib/gitlab/utils.rb')
-rw-r--r--lib/gitlab/utils.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/utils.rb b/lib/gitlab/utils.rb
index fa22f0e37b2..dc9391f32cf 100644
--- a/lib/gitlab/utils.rb
+++ b/lib/gitlab/utils.rb
@@ -67,5 +67,13 @@ module Gitlab
nil
end
+
+ # Used in EE
+ # Accepts either an Array or a String and returns an array
+ def ensure_array_from_string(string_or_array)
+ return string_or_array if string_or_array.is_a?(Array)
+
+ string_or_array.split(',').map(&:strip)
+ end
end
end