File: tea.rb

package info (click to toggle)
ruby-faker 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,360 kB
  • sloc: ruby: 20,654; makefile: 6; sh: 6
file content (41 lines) | stat: -rw-r--r-- 929 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
# frozen_string_literal: true

module Faker
  class Tea < Base
    flexible :tea

    class << self
      ##
      # Produces a random variety or blend of tea.
      #
      # @param type [String, nil] the type of tea to query for (valid types: 'Black', 'Green', 'Oolong', 'White', and 'Herbal')
      # @return [String] a variety of tea
      #
      # @example
      #   Faker::Tea.variety
      #     #=> "Earl Grey"
      #
      # @example
      #   Faker::Tea.variety(type: 'Green')
      #     #=> "Jasmine"
      # @faker.version next
      def variety(type: nil)
        type ||= fetch('tea.type')
        fetch "tea.variety.#{type.downcase}"
      end

      ##
      # Produces a random type of tea.
      #
      # @return [String] a type of tea
      #
      # @example
      #   Faker::Tea.type
      #     #=> "Green"
      # @faker.version next
      def type
        fetch 'tea.type'
      end
    end
  end
end