Debian Codegraph @

doc/_includes/examples/mixins.jsonnet

raw
1 local sours = import 'sours-oo.jsonnet';
2
3 local RemoveGarnish = {
4 // Not technically removed, but made hidden.
5 garnish:: super.garnish,
6 };
7
8 // Make virgin cocktails
9 local NoAlcohol = {
10 local Substitute(ingredient) =
11 local k = ingredient.kind;
12 local bitters = 'Angustura Bitters';
13 if k == 'Whiskey' then [
14 { kind: 'Water', qty: ingredient.qty },
15 { kind: bitters, qty: 'tsp' },
16 ] else if k == 'Banks 7 Rum' then [
17 { kind: 'Water', qty: ingredient.qty },
18 { kind: 'Vanilla Essence', qty: 'dash' },
19 { kind: bitters, qty: 'dash' },
20 ] else [
21 ingredient,
22 ],
23 ingredients: std.flattenArrays([
24 Substitute(i)
25 for i in super.ingredients
26 ]),
27 };
28
29 local PartyMode = {
30 served: 'In a plastic cup',
31 };
32
33 {
34 'Whiskey Sour':
35 sours['Whiskey Sour']
36 + RemoveGarnish + PartyMode,
37
38 'Virgin Whiskey Sour':
39 sours['Whiskey Sour'] + NoAlcohol,
40
41 'Virgin Daiquiri':
42 sours.Daiquiri + NoAlcohol,
43
44 }