Class: Brewery::Priming

Inherits:
Object
  • Object
show all
Defined in:
lib/brewery/priming.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#heightObject

Returns the value of attribute height.



3
4
5
# File 'lib/brewery/priming.rb', line 3

def height
  @height
end

#radiusObject

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_cylinderObject



10
11
12
# File 'lib/brewery/priming.rb', line 10

def volume_of_cylinder
  ((3.14 * @radius * @radius * @height) / 1000).round(3)
end