To_yaml problem with option hash

Hi,

I’m trying to make a fixture for testing with a serialized column. In
the YAML fixture I’m trying to fill the serialized column with the
to_yaml function. But I keep getting the ‘—’ separator, which I don’t
want because it is only a ‘partial’ yaml fill.

According to the documentation to_yaml takes a hash of options, so
something like .to_yaml( :Indent => 4, :Separator => ‘’). I’ve tried
this but the option hash has no effect, the default stay in place.

Does anyone have an idea?
Thank in advance, Bas

CODE example (test_fixture.yml):

<% hash_small = { “0”=>“1”, “1”=>“2”, “2”=>“3”, “3”=>“4” } %>

first:
id: 1
name: Test Hash
data: <%= hash_small.to_yaml( :Indent => 8, :Separator => ‘’) %>
datetime: <%= datetime %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs