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
wishdev@gmail.com