Sha256: c38c4b225b78d2786ae3e18bb137ec232a98f3a4028f313caee3f38c4c35738d
Contents?: true
Size: 610 Bytes
Versions: 23
Compression:
Stored size: 610 Bytes
Contents
require "json" require "yaml" module Kubes::Compiler::Util module YamlDump def yaml_dump(data) if data.is_a?(Kubes::Compiler::Dsl::Core::Blocks) items = data.results.map { |k,v| standardize_yaml(v) } items.map(&:to_yaml).join("") else 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
23 entries across 23 versions & 1 rubygems