Module: Alcohol
- Defined in:
- lib/alcohol.rb
Overview
Calculate the alcohol content of beer
Class Method Summary collapse
-
.by_volume(original, terminal) ⇒ Float
Calculates alcohol by volume.
-
.by_weight(original, terminal) ⇒ Float
Calculates alcohol by weight.
Class Method Details
.by_volume(original, terminal) ⇒ Float
Note:
Extract must be measured in Plato
Calculates alcohol by volume
31 32 33 |
# File 'lib/alcohol.rb', line 31 def self.by_volume original, terminal ((by_weight original, terminal) / 0.793573).round 1 end |
.by_weight(original, terminal) ⇒ Float
Note:
Extract must be measured in Plato
Calculates alcohol by weight
15 16 17 18 |
# File 'lib/alcohol.rb', line 15 def self.by_weight original, terminal ((original - ((0.1808 * original) + (0.8192 * terminal))) / (2.0665 - (0.010665 * original))).round 1 end |