Sha256: 4feb92812ef9d3817ce55be9334f36261d3eb82a4564a4068597cba0ab223fa5
Contents?: true
Size: 624 Bytes
Versions: 26
Compression:
Stored size: 624 Bytes
Contents
require "json" require "yaml" module Kubes::Compiler::Util module YamlDump def yaml_dump(data) case data when Array items = data.map do |i| standardize_yaml(i) end items.map(&:to_yaml).join("") else # single resource in YAML data = standardize_yaml(data) data.to_yaml end end # https://stackoverflow.com/questions/24508364/how-to-emit-yaml-in-ruby-expanding-aliases/46104244#46104244 # Prevents YAML from generating aliases/anchors. def standardize_yaml(data) json = data.to_json YAML.load(json) end end end
Version data entries
26 entries across 26 versions & 1 rubygems