Ruby YAML delimiter
Is there any way to change the delimiter that is used when Ruby creates a YAML file?
What is given right now:
---
- de
- abbrv开发者_JS百科_apr: APR
What is wanted:
\t de
\t abbrv_apr: APR
The \t
is a tab, so basically I want all of the dashes to be gone from the created yaml files
I was able to fix my problem by creating a nested sequence http://www.yaml.org/YAML_for_ruby.html#nested_sequences
YAML is a format that does not allow for such customizations.
Of course, you can always do obj.to_yaml.gsub(/^-/, "\t")
if you need to. (with /^\t/, '-'
on read)
精彩评论