dennismonsewicz
dennismonsewicz

Reputation: 25542

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_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

Upvotes: 0

Views: 1188

Answers (1)

glebm
glebm

Reputation: 21100

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)

Upvotes: 2

Related Questions