Hi --

On Sat, 22 Apr 2006, 13 wrote:

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

Can you just do this?

first:
   id: 1
   filename: dummy1.png
   params:
     dates: ['2006-04-20']
     currencies: ['USD']


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!