blob: 292c8de6229e05cb3c5a37857684f4d8e3a01200 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
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.symbolize_keys.tap do |variable|
variable[:key] = variable[:key].to_s
end
end
end
def dump(object)
YAML.dump(object)
end
end
end
end
end
|