-
Given the following Ruby script: require 'yaml'
puts YAML::VERSION
text = <<~TXT
items:
tags:
- 0001
- 0002
- 0003
- 0004
- 0005
- 0006
- 0007
- 0008
- 0009
TXT
puts YAML.dump YAML.load(text) when run outputs the following:
Any reason why there's a special behavior for numbers |
Beta Was this translation helpful? Give feedback.
Answered by
perlpunk
Dec 28, 2020
Replies: 1 comment
-
ruby psych implements YAML 1.1. https://perlpunk.github.io/yaml-test-schema/schemas.html |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hsbt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ruby psych implements YAML 1.1. https://perlpunk.github.io/yaml-test-schema/schemas.html
0001
-0007
are read as octal numbers.0008
and0009
can't be octal, so they are resolved as a string. When dumping again, I guess they are quoted to make clear that they are strings, but the quotes wouldn't be strictly required.