Class: Brewery::Priming
- Inherits:
-
Object
- Object
- Brewery::Priming
- Defined in:
- lib/brewery/priming.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#radius ⇒ Object
Returns the value of attribute radius.
Instance Method Summary collapse
-
#initialize(args) ⇒ Priming
constructor
A new instance of Priming.
-
#total(args) ⇒ Object
TODO Config initializer to set the units.
- #volume_of_cylinder ⇒ Object
Constructor Details
#initialize(args) ⇒ Priming
5 6 7 8 |
# File 'lib/brewery/priming.rb', line 5 def initialize(args) @radius = args[:radius] @height = args[:height] end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
3 4 5 |
# File 'lib/brewery/priming.rb', line 3 def height @height end |
#radius ⇒ Object
Returns the value of attribute radius.
3 4 5 |
# File 'lib/brewery/priming.rb', line 3 def radius @radius end |
Instance Method Details
#total(args) ⇒ Object
TODO Config initializer to set the units
16 17 18 19 20 21 |
# File 'lib/brewery/priming.rb', line 16 def total(args) gr = args[:sugar] sugar = (volume_of_cylinder * gr).round(3) water = sugar * 3 return sugar, water end |
#volume_of_cylinder ⇒ Object
10 11 12 |
# File 'lib/brewery/priming.rb', line 10 def volume_of_cylinder ((3.14 * @radius * @radius * @height) / 1000).round(3) end |