class BeerRecipe::HopWrapper
Public Instance Methods
aau()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 11 def aau @record.alpha * amount * 0.035274 end
adjust_bitterness(ibu)
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 36 def adjust_bitterness(ibu) if @record.form == 'Pellet' ibu *= 1.10 elsif @record.form == 'Plug' ibu *= 1.02 end if @record.use == 'Mash' ibu *= 0.20 elsif @record.use == 'First Wort' ibu *= 1.10 elsif @record.use == 'Aroma' ibu *= 0.50 end ibu end
amount()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 3 def amount if @record.amount < 1 @record.amount * 1000 else @record.amount end end
amount_percent()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 96 def amount_percent amount / @recipe.total_hops * 100 end
boil_time()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 64 def boil_time if dryhop? 0 else @record.time.to_i / 60 end end
calculate_ibu()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 24 def calculate_ibu # TODO: Use recipe boil time for first wort/mash # TODO: Use calculated_og if og missing. if has_needed_ibu_values? && contributes_bitterness? ibu = BeerRecipe::Formula.new.tinseth(@recipe.batch_size, @record.time.to_i, @recipe.og, @record.alpha, amount) ibu = adjust_bitterness(ibu) ibu else 0 end end
contributes_bitterness?()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 52 def contributes_bitterness? !dryhop? end
dryhop?()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 60 def dryhop? @record.use == 'Dry Hop' || @record.time.to_i > 320 end
formatted_amount()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 88 def formatted_amount "#{'%.0f' % amount}" end
formatted_ibu()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 92 def formatted_ibu "#{'%.1f' % ibu}" end
formatted_time()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 72 def formatted_time if dryhop? "#{'%.0f' % (@record.time.to_i / 1440)}" else "#{'%.0f' % @record.time.to_i}" end end
has_needed_ibu_values?()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 56 def has_needed_ibu_values? @recipe.has_final_values? && @recipe.batch_size > 0 && amount > 0 && @record.time.to_i > 0 end
ibu()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 20 def ibu @ibu ||= calculate_ibu end
mgl_added_alpha_acids()
click to toggle source
mg/l of added alpha acids
# File lib/beer_recipe/hop_wrapper.rb, line 16 def mgl_added_alpha_acids BeerRecipe::Formula.new.mgl_added_alpha_acids(@recipe.batch_size, @record.alpha, amount) end
time_unit()
click to toggle source
# File lib/beer_recipe/hop_wrapper.rb, line 80 def time_unit if dryhop? 'days' else 'min' end end