Class: Faker::Tea

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/tea.rb

Constant Summary

Constants inherited from Base

Base::LLetters, Base::Letters, Base::NOT_GIVEN, Base::Numbers, Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, translate, unique, with_locale

Class Method Details

.typeString

Produces a random type of tea.

Examples:

Faker::Tea.type
  #=> "Green"

Returns:

  • (String)

    a type of tea

Available since:

  • next


36
37
38
# File 'lib/faker/default/tea.rb', line 36

def type
  fetch 'tea.type'
end

.variety(type: nil) ⇒ String

Produces a random variety or blend of tea.

Examples:

Faker::Tea.variety
  #=> "Earl Grey"
Faker::Tea.variety(type: 'Green')
  #=> "Jasmine"

Parameters:

  • type (String, nil) (defaults to: nil)

    the type of tea to query for (valid types: 'Black', 'Green', 'Oolong', 'White', and 'Herbal')

Returns:

  • (String)

    a variety of tea

Available since:

  • next


22
23
24
25
# File 'lib/faker/default/tea.rb', line 22

def variety(type: nil)
  type ||= fetch('tea.type')
  fetch "tea.variety.#{type.downcase}"
end