File: food_pl.rb

package info (click to toggle)
ruby-ffaker 2.23.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,776 kB
  • sloc: ruby: 12,788; makefile: 8; sh: 1
file content (65 lines) | stat: -rw-r--r-- 961 bytes parent folder | download | duplicates (2)
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
# frozen_string_literal: true

module FFaker
  module FoodPL
    extend ModuleUtils
    extend self

    def food
      case rand(0..1)
      when 0 then processed
      when 1 then unprocessed
      end
    end

    def processed
      case rand(0..2)
      when 0 then fermented
      when 1 then diary
      when 2 then preserves
      end
    end

    def unprocessed
      case rand(0..4)
      when 0 then vegetable
      when 1 then fruit
      when 2 then herb
      when 3 then spice
      when 4 then meat
      end
    end

    def vegetable
      fetch_sample(VEGETABLES)
    end

    def fruit
      fetch_sample(FRUITS)
    end

    def herb
      fetch_sample(HERBS)
    end

    def spice
      fetch_sample(SPICES)
    end

    def meat
      fetch_sample(MEATS)
    end

    def fermented
      fetch_sample(FERMENTED)
    end

    def diary
      fetch_sample(DIARY)
    end

    def preserves
      fetch_sample(PRESERVES)
    end
  end
end