Module: Gitlab::Serializer::Ci::Variables
Overview
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.
Instance Method Summary collapse
Instance Method Details
#dump(object) ⇒ Object
24 25 26 |
# File 'lib/gitlab/serializer/ci/variables.rb', line 24 def dump(object) YAML.dump(object) end |
#load(string) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitlab/serializer/ci/variables.rb', line 12 def load(string) return unless string object = YAML.safe_load(string, permitted_classes: [Symbol]) object.map do |variable| variable.symbolize_keys.tap do |variable| variable[:key] = variable[:key].to_s end end end |