class Rubybody::Food
Attributes
alcohol_grams[RW]
carb_grams[RW]
fat_grams[RW]
protein_grams[RW]
Public Class Methods
new(protein_grams, carb_grams, fat_grams, alcohol_grams=0)
click to toggle source
All nutriments are expressed in grams
# File lib/rubybody/nutrition.rb, line 13 def initialize(protein_grams, carb_grams, fat_grams, alcohol_grams=0) self.protein_grams = protein_grams self.carb_grams = carb_grams self.fat_grams = fat_grams self.alcohol_grams = alcohol_grams end
Public Instance Methods
calories()
click to toggle source
# File lib/rubybody/nutrition.rb, line 20 def calories return self.protein_grams * PROTEIN_CALORIES + self.carb_grams * CARB_CALORIES + self.fat_grams * FAT_CALORIES + self.alcohol_grams * ALCOHOL_CALORIES end