Class: Faker::Beer

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

Constant Summary

Constants inherited from Base

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

Class Method Summary collapse

Methods inherited from Base

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

Class Method Details

.alcoholString

Produces a random beer alcohol percentage.

Examples:

Faker::Beer.alcohol #=> "5.4%"

Returns:

  • (String)

Available since:

  • 1.6.2



95
96
97
# File 'lib/faker/default/beer.rb', line 95

def alcohol
  "#{rand(2.0..10.0).round(1)}%"
end

.blgString

Produces a random beer blg level.

Examples:

Faker::Beer.blg #=> "5.1Blg"

Returns:

  • (String)

Available since:

  • 1.6.2



108
109
110
# File 'lib/faker/default/beer.rb', line 108

def blg
  "#{rand(5.0..20.0).round(1)}°Blg"
end

.hopString

Produces a random beer hops.

Examples:

Faker::Beer.hop #=> "Sterling"

Returns:

  • (String)

Available since:

  • 1.6.2



43
44
45
# File 'lib/faker/default/beer.rb', line 43

def hop
  fetch('beer.hop')
end

.ibuString

Produces a random beer IBU.

Examples:

Faker::Beer.ibu #=> "87 IBU"

Returns:

  • (String)

Available since:

  • 1.6.2



82
83
84
# File 'lib/faker/default/beer.rb', line 82

def ibu
  "#{rand(10..100)} IBU"
end

.maltsString

Produces a random beer malt.

Examples:

Faker::Beer.malts #=> "Munich"

Returns:

  • (String)

Available since:

  • 1.6.2



69
70
71
# File 'lib/faker/default/beer.rb', line 69

def malts
  fetch('beer.malt')
end

.nameString

Produces a random beer name.

Examples:

Faker::Beer.name #=> "Pliny The Elder"

Returns:

  • (String)

Available since:

  • 1.6.2



17
18
19
# File 'lib/faker/default/beer.rb', line 17

def name
  fetch('beer.name')
end

.styleString

Produces a random beer style.

Examples:

Faker::Beer.style #=> "Wood-aged Beer"

Returns:

  • (String)

Available since:

  • 1.6.2



30
31
32
# File 'lib/faker/default/beer.rb', line 30

def style
  fetch('beer.style')
end

.yeastString

Produces a random beer yeast.

Examples:

Faker::Beer.yeast #=> "5335 - Lactobacillus"

Returns:

  • (String)

Available since:

  • 1.6.2



56
57
58
# File 'lib/faker/default/beer.rb', line 56

def yeast
  fetch('beer.yeast')
end