Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double quote string when non word character appears in string #21

Closed
take-cheeze opened this issue Oct 15, 2019 · 1 comment
Closed

Comments

@take-cheeze
Copy link
Member

take-cheeze commented Oct 15, 2019

(Reported by @k0kubun san in ruby-jp slack #mruby channel)

yaml = 'foo:
- /bar
- /baz'
puts YAML.dump(YAML.load(yaml))

psych

---
foo:
- "/bar"
- "/baz"

mruby

---
foo:
- /bar
- /baz

Psych seems to change the style of scalar depending on what's inside:
https://github.com/ruby/psych/blob/7bebf65e4d90a75b79057e50a89ca5af3f53500a/lib/psych/visitors/yaml_tree.rb#L277-L278

So we need to change the style like psych here:

yaml_scalar_style_t style = YAML_ANY_SCALAR_STYLE;

@k0kubun
Copy link
Contributor

k0kubun commented Oct 15, 2019

Roughly approached in 1fc78d0

@k0kubun k0kubun closed this as completed Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants