Open zeionara opened 1 year ago
Closes #279
In current version all doubles are encoded in a scientific notation:
import Yams print(try Yams.dump(object: 6.85)))
produces:
6.85e+0
The proposed change is to add a static option to Emitter.Options class, so it can be used as follows:
Emitter.Options
import Yams Emitter.Options.doubleFormatStyle = .decimal print(try Yams.dump(object: 6.85)))
which produces the expected result:
6.85
YAMLEncoder object is also supported, as well as numbers with zero fraction part, which are not saved as integers. For example, the following code:
YAMLEncoder
import Yams Emitter.Options.doubleFormatStyle = .decimal print(try YAMLEncoder().encode(6.0)))
generates the expected result:
6.0
Very nice, thanks for the PR! I'll take a look shortly.
Could you please address the failing CI jobs? Missing documentation comments and SwiftLint rule violations. Also CMake updates.
Closes #279
In current version all doubles are encoded in a scientific notation:
produces:
The proposed change is to add a static option to
Emitter.Options
class, so it can be used as follows:which produces the expected result:
YAMLEncoder
object is also supported, as well as numbers with zero fraction part, which are not saved as integers. For example, the following code:generates the expected result: