lib/yaml-write-stream/stateful.rb in yaml-write-stream-1.0.2 vs lib/yaml-write-stream/stateful.rb in yaml-write-stream-1.0.3

- old
+ new

@@ -113,12 +113,21 @@ def current stack.last end def write_scalar(value) - # value, anchor, tag, plain, quoted, style + style = if value == '' + Psych::Nodes::Scalar::DOUBLE_QUOTED + else + Psych::Nodes::Scalar::ANY + end + + quoted = value == '' + value = value ? value : '' + + # value, anchor, tag, plain, quoted, style emitter.scalar( - value, nil, nil, true, false, Psych::Nodes::Scalar::ANY + value, nil, nil, true, quoted, style ) end end class StatefulMappingWriter < StatefulWriter