sfMergeKey.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. --- %YAML:1.0
  2. test: Simple In Place Substitution
  3. brief: >
  4. If you want to reuse an entire alias, only overwriting what is different
  5. you can use a << in place substitution. This is not part of the official
  6. YAML spec, but a widely implemented extension. See the following URL for
  7. details: http://yaml.org/type/merge.html
  8. yaml: |
  9. foo: &foo
  10. a: Steve
  11. b: Clark
  12. c: Brian
  13. bar:
  14. a: before
  15. d: other
  16. <<: *foo
  17. b: new
  18. x: Oren
  19. c:
  20. foo: bar
  21. foo: ignore
  22. bar: foo
  23. duplicate:
  24. foo: bar
  25. foo: ignore
  26. foo2: &foo2
  27. a: Ballmer
  28. ding: &dong [ fi, fei, fo, fam]
  29. check:
  30. <<:
  31. - *foo
  32. - *dong
  33. isit: tested
  34. head:
  35. <<: [ *foo , *dong , *foo2 ]
  36. taz: &taz
  37. a: Steve
  38. w:
  39. p: 1234
  40. nested:
  41. <<: *taz
  42. d: Doug
  43. w: &nestedref
  44. p: 12345
  45. z:
  46. <<: *nestedref
  47. php: |
  48. array(
  49. 'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian'),
  50. 'bar' => array('a' => 'before', 'd' => 'other', 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'),
  51. 'duplicate' => array('foo' => 'bar'),
  52. 'foo2' => array('a' => 'Ballmer'),
  53. 'ding' => array('fi', 'fei', 'fo', 'fam'),
  54. 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'),
  55. 'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'fi', 'fei', 'fo', 'fam'),
  56. 'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)),
  57. 'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345))
  58. )