-
Notifications
You must be signed in to change notification settings - Fork 212
/
pizza.ex
571 lines (518 loc) · 12 KB
/
pizza.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
defmodule Faker.Pizza do
import Faker, only: [sampler: 2]
alias Faker.Util
@moduledoc """
Functions for generating Pizza related data in English.
"""
@doc """
Returns a list with a number of pizzas.
If an integer is provided, exactly that number of pizzas will be returned.
If a range is provided, the number will be in the range.
If no range or integer is specified it defaults to 2..5
## Examples
iex> Faker.Pizza.pizzas()
[
"14\\" Greek Maltija",
"Large with Reindeer, Buffalo Chicken, Egg, Chorizo, and Clam",
"9\\" Capricciosa",
"9\\" Sicilian Style Frutti di mare"
]
iex> Faker.Pizza.pizzas(2..3)
[
"12\\" Fajita",
"Medium Fajita"
]
iex> Faker.Pizza.pizzas(3..4)
[
"Large Gluten-Free Corn with Oysters, Bacon, and Steak",
"10\\" Flatbread Grilled Vegetarian",
"30\\" Thai Chicken",
"Small with Sauerkraut"
]
iex> Faker.Pizza.pizzas(5)
[
"Large Quattro Formaggio",
"Small Sweet Potato Crust with Mackerel, Jalapeños, Smoked Mozzarella, and Smoked Salmon",
"30\\" with Pickled Ginger, Meatballs, Goat Cheese, Prosciutto, and Pineapple",
"9\\" Detroit-style with Steak",
"Family with Clam, Cherry Tomatoes, Salmon, and Chicken"
]
"""
@spec pizzas(Range.t()) :: list(String.t())
def pizzas(range \\ 2..5)
def pizzas(first..last) do
pizzas(Faker.random_between(first, last))
end
@spec pizzas(integer) :: list(String.t())
def pizzas(num) do
stream = Stream.repeatedly(&pizza/0)
Enum.take(stream, num)
end
@doc """
Returns a pizza
## Examples
iex> Faker.Pizza.pizza()
"16\\" with Fior di latte"
iex> Faker.Pizza.pizza()
"Medium New York Style with Clam and Reindeer"
iex> Faker.Pizza.pizza()
"9\\" Supreme"
iex> Faker.Pizza.pizza()
"16\\" Shrimp Club"
"""
@spec pizza() :: String.t()
def pizza, do: pizza(Faker.random_between(1, 30))
defp pizza(n) when n <= 5, do: "#{size_or_inches()} with #{toppings_sentence(n)}"
defp pizza(n) when n <= 10,
do: "#{size_or_inches()} #{style()} with #{toppings_sentence(n - 5)}"
defp pizza(n) when n <= 15, do: "#{size_or_inches()} #{style()} #{combo()}"
defp pizza(_n), do: "#{size_or_inches()} #{combo()}"
@doc """
Returns a list with a number of toppings.
If an integer is provided, exactly that number of toppings will be returned.
If a range is provided, the number will be in the range.
If no range or integer is specified it defaults to 2..5
## Examples
iex> Faker.Pizza.toppings()
["Pesto Sauce", "Fior di latte", "Broccoli", "Banana Peppers"]
iex> Faker.Pizza.toppings(4)
["Clam", "Reindeer", "Buffalo Chicken", "Egg"]
iex> Faker.Pizza.toppings(2..3)
["Sausage", "Green Peas"]
iex> Faker.Pizza.toppings(2..3)
["Shellfish", "Smoked Salmon"]
"""
@spec toppings(Range.t()) :: list(String.t())
def toppings(range \\ 2..5)
def toppings(first..last) do
toppings(Faker.random_between(first, last))
end
@spec toppings(integer) :: list(String.t())
def toppings(num) do
stream = Stream.repeatedly(&topping/0)
Enum.take(stream, num)
end
defp toppings_sentence(num) do
num |> toppings() |> Util.to_sentence()
end
@doc """
Returns a random cheese, sauce, meat or vegetarian topping
## Examples
iex> Faker.Pizza.topping()
"Black Olives"
iex> Faker.Pizza.topping()
"Meatballs"
iex> Faker.Pizza.topping()
"Asiago"
iex> Faker.Pizza.topping()
"Philly Steak"
"""
@spec topping() :: String.t()
def topping, do: topping(Faker.random_between(0, 7))
defp topping(0), do: cheese()
defp topping(1), do: sauce()
defp topping(count) when count <= 5, do: meat()
defp topping(_count), do: vegetable()
@doc """
Returns a Pizza Restaurant string
## Examples
iex> Faker.Pizza.company()
"Papa Plastique"
iex> Faker.Pizza.company()
"Chicago Deep Dish"
iex> Faker.Pizza.company()
"Pizza Joe’s"
iex> Faker.Pizza.company()
"CosaNostra Pizza"
"""
@spec company() :: String.t()
sampler(:company, [
"New York Style Pizza Co",
"Chicago Deep Dish",
"Pizza the Hutt",
"Mystic Pizza",
"Bob's Pizza-Burgers",
"Only Cheese Pizzas",
"California Style Pizzas",
"Thin Crust or Bust",
"Family Bros. Pizza",
"Pizza Planet",
"Polmieri Pizzeria",
"Cheese E. Sneezers",
"Mona Pizza",
"J. Maggio's Pizza",
"Pizza De Roma",
"Dinosaur Pizza",
"Pizza Potamus",
"Pizza Forest",
"Pizza This..",
"Little Nero's Pizza",
"Freddy Fazbear's Pizza",
"The Pizza Hole",
"Bloaty’s Pizza Hog",
"Guidio’s Pizza Palace",
"CosaNostra Pizza",
"Gamer Pizzas",
"Jubilee Pizza",
"Maria’s Pasta and Pizza",
"Nemo’s Pizza",
"Paisanos",
"Papa Plastique",
"Pete’s Pizza",
"Pizza Clown",
"Pizza Face Pizza",
"Pizza on a Stick",
"Pizza Joe’s",
"Pizza Pig-Out",
"Pizza Shack",
"Ron’s Pizza Hovel",
"Sid’s Pizza Parlor"
])
@doc """
Returns a pizza style
## Examples
iex> Faker.Pizza.style()
"Pizza Frittata"
iex> Faker.Pizza.style()
"Gluten-Free Corn"
iex> Faker.Pizza.style()
"Detroit-style"
iex> Faker.Pizza.style()
"Stuffed Crust"
"""
@spec style() :: String.t()
sampler(:style, [
"Wood Fired",
"Thick Crust",
"Thin Crust",
"New York Style",
"Deep Dish",
"Stuffed Crust",
"Detroit-style",
"Kosher",
"Gluten-Free Quinoa",
"Flatbread",
"Sweet Potato Crust",
"Grilled",
"New Haven Style",
"Greek",
"Sicilian Style",
"Pizza Rustica",
"Tomato Pie",
"Pizza Bread",
"Neapolitan",
"Deep Fried Pizza",
"Gluten-Free Corn",
"Pizza Frittata",
"Hand Tossed",
"Multigrain",
"Whole Wheat",
"Fugazza",
"Spooning Pizza"
])
@doc """
Returns a sauce string
## Examples
iex> Faker.Pizza.sauce()
"Spicy Tomato Sauce"
iex> Faker.Pizza.sauce()
"Hummus"
iex> Faker.Pizza.sauce()
"Pesto Sauce"
iex> Faker.Pizza.sauce()
"Hummus"
"""
@spec sauce() :: String.t()
sampler(:sauce, [
"Soy Miso Sauce",
"Masala Sauce",
"Classic Tomato Sauce",
"Spicy Tomato Sauce",
"Clam Sauce",
"Bechamel (White) Sauce",
"Pesto Sauce",
"BBQ Sauce",
"Salsa",
"Passata Sauce",
"Chipolte Sauce",
"Mango Sauce",
"Siracha Sauce",
"Buffalo Sauce",
"Tomato Garlic Sauce",
"Butter Chicken Sauce",
"Olive Oil",
"Hummus",
"White Garlic Sauce",
"Marinara Sauce",
"Tapenade",
"Romesco Sauce",
"Chimichurri Sauce",
"Gravy",
"Aioli",
"Hoisin Sauce",
"Chili Sauce",
"Sweet Chili Sauce",
"Gremolata",
"Mustard",
"Curry",
"Alfredo Sauce",
"Zaatar"
])
@doc """
Returns a cheese string
## Examples
iex> Faker.Pizza.cheese()
"Mozzarella"
iex> Faker.Pizza.cheese()
"Marscapone"
iex> Faker.Pizza.cheese()
"Blue (Bleu) Cheese"
iex> Faker.Pizza.cheese()
"Smoked Mozzarella"
"""
@spec cheese() :: String.t()
sampler(:cheese, [
"Mozzarella",
"Cheddar",
"Feta",
"Secret Cheese Blend",
"4 Cheese Blend",
"Buffalo Mozzarella",
"Asiago",
"Romano",
"Provolone",
"Emmental",
"Ricotta",
"Marscapone",
"Swiss",
"Parmesan",
"Smoked Mozzarella",
"Blue (Bleu) Cheese",
"Soy Cheese",
"Lactose Free Cheese",
"Whole Milk Mozzarella",
"Burrata",
"Goat Cheese",
"Cashew Cheese",
"Fior di latte",
"Paneer",
"Cheese Curds",
"Gouda",
"Fontina",
"Gorgonzola",
"Queso Fresco",
"Crème fraîche"
])
@doc """
Returns a meat string
## Examples
iex> Faker.Pizza.meat()
"Buffalo Chicken"
iex> Faker.Pizza.meat()
"Meatballs"
iex> Faker.Pizza.meat()
"Chicken"
iex> Faker.Pizza.meat()
"Meatballs"
"""
@spec meat() :: String.t()
sampler(:meat, [
"Anchovies",
"Bacon",
"Pulled Pork",
"Buffalo Chicken",
"Canadian Bacon",
"Capicola",
"Chicken",
"Chorizo",
"Clam",
"Duck",
"Eel",
"Egg",
"Gyro",
"Ham",
"Hamburger",
"Hot Dogs",
"Mackerel",
"Meatballs",
"Mutton",
"Pepperoni",
"Philly Steak",
"Prosciutto",
"Reindeer",
"Salami",
"Salmon",
"Sausage",
"Scallops",
"Shellfish",
"Shrimps",
"Smoked Salmon",
"Squid",
"Steak",
"Venison"
])
@doc """
Returns a vegetable string
## Examples
iex> Faker.Pizza.vegetable()
"Mango"
iex> Faker.Pizza.vegetable()
"Black Olives"
iex> Faker.Pizza.vegetable()
"Green Olives"
iex> Faker.Pizza.vegetable()
"Sauerkraut"
"""
@spec vegetable() :: String.t()
sampler(:vegetable, [
"Artichoke Hearts",
"Arugula",
"Banana",
"Banana Peppers",
"Basil",
"Black Olives",
"Broccoli",
"Capers",
"Caramelised Onions",
"Cherry Tomatoes",
"Coconut",
"Eggplant",
"Garlic",
"Green Olives",
"Green Peas",
"Green Peppers",
"Habanero Peppers",
"Jalapeños",
"Mango",
"Mushrooms",
"Onions",
"Oysters",
"Peperoncini",
"Pickled Ginger",
"Pineapple",
"Potatoes",
"Red Onion",
"Red Peppers",
"Sauerkraut",
"Spinach",
"Sun-Dried Tomatoes",
"Sweet Corn",
"Sweet Potato",
"Zucchini"
])
@doc """
Returns a combo string
## Examples
iex> Faker.Pizza.combo()
"Breakfast"
iex> Faker.Pizza.combo()
"Caprese"
iex> Faker.Pizza.combo()
"Mockba"
iex> Faker.Pizza.combo()
"Poutine"
"""
@spec combo() :: String.t()
sampler(:combo, [
"Africana",
"All Dressed",
"Bacon Cheeseburger ",
"BBQ Chicken",
"Bianca ",
"Bolognese",
"Breakfast",
"Buffalo Chicken",
"Canadian",
"Caprese",
"Capricciosa",
"Capricciosa ",
"Cheese",
"Chicken Pesto",
"Ciao-ciao",
"Curry Banana",
"Double Dutch",
"Fajita",
"Fig and Goat Cheese",
"Four Seasons",
"Frutti di mare",
"Funghi",
"Grandma",
"Greek",
"Grilled Vegetarian",
"Hawaiian",
"Hot & Spicy",
"Italian Deli",
"Kebab",
"Loaded",
"Maltija",
"Margherita",
"Meat Feast",
"Meat Lovers",
"Meatball ",
"Mockba",
"Onion & Gorgonzola",
"Pepperoni & Mushroom",
"Perogie",
"Pesto Chicken",
"Poutine",
"Prociutto Arugala",
"Pugliese",
"Quattro Formaggi",
"Quattro Formaggio",
"Quattro stagioni",
"Romana",
"Shrimp Club",
"Smoked Salmon & Goat Cheese",
"Supreme",
"Taco",
"Thai Chicken",
"Vegetarian Lovers",
"Vegetariana",
"Veggie Korma",
"Viennese"
])
@doc """
Returns a random size or inches
## Examples
iex> Faker.Pizza.size_or_inches()
"Family"
iex> Faker.Pizza.size_or_inches()
"14\\""
iex> Faker.Pizza.size_or_inches()
"Personal"
iex> Faker.Pizza.size_or_inches()
"Medium"
"""
@spec size_or_inches() :: String.t()
def size_or_inches, do: size_or_inches(Faker.random_between(0, 1))
defp size_or_inches(0), do: size()
defp size_or_inches(1), do: inches()
@doc """
Returns a size string
## Examples
iex> Faker.Pizza.size()
"Personal"
iex> Faker.Pizza.size()
"Family"
iex> Faker.Pizza.size()
"Large"
iex> Faker.Pizza.size()
"Medium"
"""
@spec size() :: String.t()
sampler(:size, ["Personal", "Small", "Medium", "Large", "Extra-Large", "Family"])
@doc """
Returns an inches string
## Examples
iex> Faker.Pizza.inches()
"9\\""
iex> Faker.Pizza.inches()
"10\\""
iex> Faker.Pizza.inches()
"16\\""
iex> Faker.Pizza.inches()
"14\\""
"""
@spec inches() :: String.t()
sampler(:inches, ["9\"", "10\"", "11\"", "12\"", "14\"", "16\"", "18\"", "20\"", "26\"", "30\""])
end