Debian Codegraph @

doc/_includes/examples/sours-oo.jsonnet

raw
1 local templates = import 'templates.libsonnet';
2
3 {
4 // The template requires us to override
5 // the 'spirit'.
6 'Whiskey Sour': templates.Sour {
7 spirit: 'Whiskey',
8 },
9
10 // Specialize it further.
11 'Deluxe Sour': self['Whiskey Sour'] {
12 // Don't replace the whole sweetner,
13 // just change 'kind' within it.
14 sweetener+: { kind: 'Gomme Syrup' },
15 },
16
17 Daiquiri: templates.Sour {
18 spirit: 'Banks 7 Rum',
19 citrus+: { kind: 'Lime' },
20 // Any field can be overridden.
21 garnish: 'Lime wedge',
22 },
23
24 "Nor'Easter": templates.Sour {
25 spirit: 'Whiskey',
26 citrus: { kind: 'Lime', qty: 0.5 },
27 sweetener+: { kind: 'Maple Syrup' },
28 // +: Can also add to a list.
29 ingredients+: [
30 { kind: 'Ginger Beer', qty: 1 },
31 ],
32 },
33 }