Class: Beerxml::Recipe
- Includes:
- DataMapper::Resource
- Defined in:
- lib/beerxml/recipe.rb
Instance Method Summary collapse
-
#beerxml_relationships ⇒ Object
has n, :waters.
- #calculate_fg ⇒ Object
- #calculate_og ⇒ Object
- #color ⇒ Object
- #tinseth ⇒ Object (also: #ibus)
Methods inherited from Model
beerxml_name, beerxml_plural_name, collection_from_xml, #each_beerxml_relationship, from_xml, #from_xml, inherited, #read_xml_field, #to_beerxml, #to_xml, xml_attr_name
Instance Method Details
#beerxml_relationships ⇒ Object
has n, :waters
20 21 22 |
# File 'lib/beerxml/recipe.rb', line 20 def beerxml_relationships [:hops, :fermentables, :miscs, :yeasts, :waters] end |
#calculate_fg ⇒ Object
64 65 66 67 |
# File 'lib/beerxml/recipe.rb', line 64 def calculate_fg og = calculate_og Beerxml.round(og - ((og - 1) * yeasts.first.attenuation * 0.01), 3) end |
#calculate_og ⇒ Object
58 59 60 61 62 |
# File 'lib/beerxml/recipe.rb', line 58 def calculate_og total_ppg = fermentables.inject(0) { |v, f| v + f.total_ppg(efficiency) } og = 1 + ((total_ppg / batch_size.in_gallons.to_f) * 0.001) Beerxml.round(og, 3) end |