Class: Faussaire::Wine
- Inherits:
-
Object
- Object
- Faussaire::Wine
- Defined in:
- lib/faussaire/wine.rb
Constant Summary collapse
- DATA_PATH =
File.('../../locale/fr.yml', __dir__)
Class Method Summary collapse
-
.bottle_type ⇒ String
Produces a random wine bottle type.
-
.licocorico ⇒ String
Produces a random wine feature called “Licocorico”.
-
.name ⇒ String
Produces a random wine name.
-
.price ⇒ String
Produces a random wine price with 99 cents and a Euro (€) symbol.
-
.region ⇒ String
Produces a random wine region.
-
.type ⇒ String
Produces a random wine type or style.
Class Method Details
.bottle_type ⇒ String
Produces a random wine bottle type.
40 41 42 |
# File 'lib/faussaire/wine.rb', line 40 def bottle_type fetch('fr.faussaire.wine.bottle_types') end |
.licocorico ⇒ String
Produces a random wine feature called “Licocorico”.
88 89 90 |
# File 'lib/faussaire/wine.rb', line 88 def licocorico fetch('fr.faussaire.wine.licocorico') end |
.name ⇒ String
Produces a random wine name.
16 17 18 |
# File 'lib/faussaire/wine.rb', line 16 def name fetch('fr.faussaire.wine.name') end |
.price ⇒ String
Produces a random wine price with 99 cents and a Euro (€) symbol. Distribution:
-
50% chance for a price between 3.5 and 499 (Low range)
-
35% chance for a price between 499 and 2999 (Middle range)
-
10% chance for a price between 3000 and 301300 (Upper-High range)
-
15% chance for a price between 301301 and 482000 (Legendary range)
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/faussaire/wine.rb', line 69 def price random_number = rand euros = case random_number when 0...0.5 then rand(3.5..499).floor when 0.5...0.85 then rand(500..2999).floor when 0.85...0.95 then rand(3000..301300).floor else rand(301301..482000).floor end "#{euros}.99€" end |
.region ⇒ String
Produces a random wine region.
52 53 54 |
# File 'lib/faussaire/wine.rb', line 52 def region fetch('fr.faussaire.wine.region') end |
.type ⇒ String
Produces a random wine type or style.
28 29 30 |
# File 'lib/faussaire/wine.rb', line 28 def type fetch('fr.faussaire.wine.type') end |