开发者

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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜