sfMergeKey.yml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. e: notnull
  14. bar:
  15. a: before
  16. d: other
  17. e: ~
  18. <<: *foo
  19. b: new
  20. x: Oren
  21. c:
  22. foo: bar
  23. foo: ignore
  24. bar: foo
  25. duplicate:
  26. foo: bar
  27. foo: ignore
  28. foo2: &foo2
  29. a: Ballmer
  30. ding: &dong [ fi, fei, fo, fam]
  31. check:
  32. <<:
  33. - *foo
  34. - *dong
  35. isit: tested
  36. head:
  37. <<: [ *foo , *dong , *foo2 ]
  38. taz: &taz
  39. a: Steve
  40. w:
  41. p: 1234
  42. nested:
  43. <<: *taz
  44. d: Doug
  45. w: &nestedref
  46. p: 12345
  47. z:
  48. <<: *nestedref
  49. php: |
  50. array(
  51. 'foo' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull'),
  52. 'bar' => array('a' => 'before', 'd' => 'other', 'e' => null, 'b' => 'new', 'c' => array('foo' => 'bar', 'bar' => 'foo'), 'x' => 'Oren'),
  53. 'duplicate' => array('foo' => 'bar'),
  54. 'foo2' => array('a' => 'Ballmer'),
  55. 'ding' => array('fi', 'fei', 'fo', 'fam'),
  56. 'check' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam', 'isit' => 'tested'),
  57. 'head' => array('a' => 'Steve', 'b' => 'Clark', 'c' => 'Brian', 'e' => 'notnull', 'fi', 'fei', 'fo', 'fam'),
  58. 'taz' => array('a' => 'Steve', 'w' => array('p' => 1234)),
  59. 'nested' => array('a' => 'Steve', 'w' => array('p' => 12345), 'd' => 'Doug', 'z' => array('p' => 12345))
  60. )