Module: Zymurgy::InstanceMethods

Defined in:
lib/zymurgy/acts_as_brew_recipe.rb,
lib/zymurgy/acts_as_brewery.rb,
lib/zymurgy/acts_as_fermentable.rb,
lib/zymurgy/acts_as_hop_addition.rb

Overview

TODO: Add hardening for when :send returns with null values.

Instance Method Summary collapse

Instance Method Details

#add_litres_to_kettle_tax(litres) ⇒ Object



16
17
18
19
# File 'lib/zymurgy/acts_as_brewery.rb', line 16

def add_litres_to_kettle_tax litres
  kettle_tax = send(:kettle_tax_litres) + litres
  send(:kettle_tax_litres=, kettle_tax)
end

#alcohol_by_volumeObject

((original gravity - final gravity)/6.8)+0.2



22
23
24
# File 'lib/zymurgy/acts_as_brew_recipe.rb', line 22

def alcohol_by_volume
  (send(:original_gravity) - send(:final_gravity)) / 6.8 + 0.2
end

#bigness_factorObject

bigness factor => 1.65*(0.000125^((original_gravity/1000)-1)) round to 2dp



17
18
19
# File 'lib/zymurgy/acts_as_brew_recipe.rb', line 17

def bigness_factor
  1.65 * 0.000125**(send(:original_gravity)/1000.0 - 1.0)
end

#IBUObject

IBU = mg/l AA * time * bigness factor



15
16
17
# File 'lib/zymurgy/acts_as_hop_addition.rb', line 15

def IBU
  alpha_acid_mg_litre * time_factor * send(:bigness_factor)
end

#mash_in_volume_litres(weight_of_total_grain_bill_kg) ⇒ Object

Mash In volume = Mash Out volume + (volume_lost_to_mash_litres_per_kg * weight of total grain bill)



36
37
38
# File 'lib/zymurgy/acts_as_brew_recipe.rb', line 36

def mash_in_volume_litres weight_of_total_grain_bill_kg
  mash_out_volume_litres + send(:volume_lost_to_mash_litres_per_kg) * weight_of_total_grain_bill_kg
end

#mash_out_volume_litresObject

Mashout volume = Post Boil Volume + (Boil Time Minutes / 60) * evaporation_rate_litres_per_hour



31
32
33
# File 'lib/zymurgy/acts_as_brew_recipe.rb', line 31

def mash_out_volume_litres
  post_boil_volume_litres() + boil_time_hours() * send(:evaporation_rate_litres_per_hour)
end

#post_boil_volume_gravity_pointsObject



20
21
22
# File 'lib/zymurgy/acts_as_fermentable.rb', line 20

def post_boil_volume_gravity_points
  volume_gravity_points(send(:post_boil_volume_litres))
end

#post_boil_volume_litresObject



26
27
28
# File 'lib/zymurgy/acts_as_brew_recipe.rb', line 26

def post_boil_volume_litres
  send(:fermentation_volume_litres) + send(:kettle_tax_litres)
end

#pre_boil_volume_gravity_pointsObject



24
25
26
# File 'lib/zymurgy/acts_as_fermentable.rb', line 24

def pre_boil_volume_gravity_points
  volume_gravity_points send(:mash_out_volume_litres)
end

#pre_boil_volume_litresObject

TODO: Alias this?



41
42
43
# File 'lib/zymurgy/acts_as_brew_recipe.rb', line 41

def pre_boil_volume_litres
  mash_out_volume_litres
end

#volume_gravity_points(volume_litres) ⇒ Object



13
14
15
16
17
18
# File 'lib/zymurgy/acts_as_fermentable.rb', line 13

def volume_gravity_points volume_litres
  maximum_volume_gravity_points = (send(:points_per_kg_per_litre) / volume_litres) * send(:weight_in_kg)

  return maximum_volume_gravity_points unless send(:mash)
  return maximum_volume_gravity_points * send(:mash_efficiency_percentage) / 100
end