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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-02-06 16:34:10 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-02-06 16:34:10 +0300
commit10c1a4d8e4828992afa56bfca6b61eeb328d851e (patch)
tree038b711172ac4ed47bb24c421611b166440b5e2f /lib/gitlab/serializer
parent50aec8dd0df863c6f129edb505218e744c479a4b (diff)
Rename `Gitlab::Serialize` module to reuse it later
Diffstat (limited to 'lib/gitlab/serializer')
-rw-r--r--lib/gitlab/serializer/ci/variables.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/gitlab/serializer/ci/variables.rb b/lib/gitlab/serializer/ci/variables.rb
new file mode 100644
index 00000000000..c059c454eac
--- /dev/null
+++ b/lib/gitlab/serializer/ci/variables.rb
@@ -0,0 +1,27 @@
+module Gitlab
+ module Serializer
+ module Ci
+ # This serializer could make sure our YAML variables' keys and values
+ # are always strings. This is more for legacy build data because
+ # from now on we convert them into strings before saving to database.
+ module Variables
+ extend self
+
+ def load(string)
+ return unless string
+
+ object = YAML.safe_load(string, [Symbol])
+
+ object.map do |variable|
+ variable[:key] = variable[:key].to_s
+ variable
+ end
+ end
+
+ def dump(object)
+ YAML.dump(object)
+ end
+ end
+ end
+ end
+end