Class: Beerxml::Fermentable
- Inherits:
-
Model
- Object
- Model
- Beerxml::Fermentable
show all
- Defined in:
- lib/beerxml/fermentable.rb
Instance Method Summary
collapse
Methods inherited from Model
beerxml_name, beerxml_plural_name, #beerxml_relationships, collection_from_xml, #each_beerxml_relationship, from_xml, #from_xml, inherited, #read_xml_field, #to_beerxml, #to_xml, xml_attr_name
Instance Method Details
#ppg ⇒ Object
28
29
30
31
|
# File 'lib/beerxml/fermentable.rb', line 28
def ppg
(self.yield * 0.01) * 46.214
end
|
#ppg=(ppg) ⇒ Object
24
25
26
|
# File 'lib/beerxml/fermentable.rb', line 24
def ppg=(ppg)
self.yield = Beerxml.round((ppg / 46.214) / 0.01, 2)
end
|
#total_color ⇒ Object
39
40
41
|
# File 'lib/beerxml/fermentable.rb', line 39
def total_color
amount.in_pounds.to_f * color
end
|
#total_ppg(efficiency = nil) ⇒ Object
33
34
35
36
37
|
# File 'lib/beerxml/fermentable.rb', line 33
def total_ppg(efficiency = nil)
total = ppg * amount.in_pounds.to_f
total *= (efficiency * 0.01) unless efficiency.nil? || type != 'Grain'
total
end
|