Sha256: 5265d3d8c17c5dccfb6ac1aef2dbcedf9e9b0898c755b3fcf93e6ca0db18b075
Contents?: true
Size: 600 Bytes
Versions: 9
Compression:
Stored size: 600 Bytes
Contents
require "json" require "yaml" module Kubes::Compiler::Util module YamlDump def yaml_dump(data) if data.key?("kind") # single resource in YAML data = standardize_yaml(data) data.to_yaml else items = data.map { |k,v| standardize_yaml(v) } items.map(&:to_yaml).join("") 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
9 entries across 9 versions & 1 rubygems