Dry YAML

Is there any way to represent the YAML fixtures in a DRY way?

For example:

train_photo:

id: 1
filename: train.jpg
created_at: 2006-04-01 03:20:49
thumbnail: t_train.jpg
description: This is a cool train!

lighthouse_photo:
id: 2
filename: lighthouse.jpg
created_at: 2006-04-02 14:58:49
thumbnail: t_lighthouse.jpg
description: My favorite lighthouse.

Why do we keep repeating the attributes?

Bala,

YAML is multipurpose and can contain many different objects within one
file

  • while it might seem nicer to have a more “intelligent” parser - for
    the
    most part it’s not like it’s a huge burden and the advantage with
    respect to
    flexibility makes it much more desirable to have it the way it is.

John W Higgins
[email protected]

On 9/27/06, Bala P. [email protected] wrote:

created_at: 2006-04-01 03:20:49
Why do we keep repeating the attributes?


John W Higgins
[email protected]

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