Hi --

On Sun, 23 Apr 2006, Trans wrote:

> 13 <one.three <at> gmail.com> writes:
>
>>
>> Hi,
>>
>> I'm trying to genereate YAML fixtures with ERB, but I can't get it to
>> work with nested maps. Here is my code:
>>
>> $ cat currencies.yml
>> first:
>>   id: 1
>>   filename: dummy1.png
>>   params:
>>     <%= { :dates => ['2006-04-20'], :currencies => ['USD'] }.to_yaml %>
>>
>> Here is what i get:
>>
>> $ erb -r yaml currencies.yml
>>
>> first:
>>   id: 1
>>   filename: dummy1.png
>>   params:
>>     ---
>> :currencies:
>> - USD
>> :dates:
>> - "2006-04-20"
>>
>> In the nested map (params column) only the first line is indented. How
>> can I configure  YAML to properly indent other lines too ? I have
>> tried to set param :Indent => 4, but without any success. Or maybe
>> there ar some other methods how can I generate fixtures such files ?
>>
>> Help me, please.
>
> You've picked an interesting way to be generating YAML --with ERB?

In Rails, the test fixture files are YAML files that get pre-processed
through ERb.


David

-- 
David A. Black (dblack / wobblini.net)
Ruby Power and Light, LLC (http://www.rubypowerandlight.com)

"Ruby for Rails" PDF now on sale!  http://www.manning.com/black
Paper version coming in early May!