diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-12-16 23:04:01 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-12-16 23:04:01 +0800 |
commit | 1b4a244dbc8d1e5b79feb4f111ec6183afa1b413 (patch) | |
tree | 2fe0e9393f4e1d25529165c0771cec96c4a6de35 /lib | |
parent | cc1eb7fec5a225342992377495e4969fdf8adf45 (diff) | |
download | gitlab-ce-1b4a244dbc8d1e5b79feb4f111ec6183afa1b413.tar.gz |
Rename to Gitlab::Serialize::Ci::Variables
Feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8088#note_20133176
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/serialize/ci/variables.rb | 32 | ||||
-rw-r--r-- | lib/gitlab/serialize/yaml_variables.rb | 31 |
2 files changed, 32 insertions, 31 deletions
diff --git a/lib/gitlab/serialize/ci/variables.rb b/lib/gitlab/serialize/ci/variables.rb new file mode 100644 index 00000000000..0ca060cd95e --- /dev/null +++ b/lib/gitlab/serialize/ci/variables.rb @@ -0,0 +1,32 @@ +module Gitlab + module Serialize + 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(&Variables.method(:convert_key_value_to_string)) + end + + def dump(object) + YAML.dump(object) + end + + private + + def convert_key_value_to_string(variable) + variable[:key] = variable[:key].to_s + variable[:value] = variable[:value].to_s + variable + end + end + end + end +end diff --git a/lib/gitlab/serialize/yaml_variables.rb b/lib/gitlab/serialize/yaml_variables.rb deleted file mode 100644 index db1e7641c74..00000000000 --- a/lib/gitlab/serialize/yaml_variables.rb +++ /dev/null @@ -1,31 +0,0 @@ - -module Gitlab - module Serialize - # 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 YamlVariables - extend self - - def load(string) - return unless string - - object = YAML.safe_load(string, [Symbol]) - - object.map(&YamlVariables.method(:convert_key_value_to_string)) - end - - def dump(object) - YAML.dump(object) - end - - private - - def convert_key_value_to_string(variable) - variable[:key] = variable[:key].to_s - variable[:value] = variable[:value].to_s - variable - end - end - end -end |