lib/aws/cfn/decompiler.rb in aws-cfn-decompiler-0.0.2 vs lib/aws/cfn/decompiler.rb in aws-cfn-decompiler-0.0.3
- old
+ new
@@ -59,17 +59,19 @@
Dir.mkdir(dir)
end
file = "#{name}.#{format}"
path = File.join(dir,file)
+ hash = { name => value }
+
begin
File.delete path if File.exists? path
File.open path, 'w' do |f|
case format
when /json/
f.write JSON.pretty_generate(compiled)
when /yaml/
- f.write value.to_yaml line_width: 1024, indentation: 4, canonical: false
+ f.write hash.to_yaml line_width: 1024, indentation: 4, canonical: false
else
raise "Unsupported format #{format}. Should have noticed this earlier!"
end
f.close
end