class MediLow
Public Class Methods
new(medical_confirmation)
click to toggle source
Calls superclass method
# File lib/medical_strategy.rb, line 100 def initialize(medical_confirmation) super() @product_allergic_3 = Product.all @medical_confirmation = medical_confirmation @customer_data = [] end
Public Instance Methods
alltogether()
click to toggle source
# File lib/medical_strategy.rb, line 108 def alltogether @product_allergic_3.each do |prod| @customer_data[prod.id] = "Hi, " if (@medical_confirmation.disease == "yes") @customer_data[prod.id] << " We care a lot for you, We have identified that you are infected with disease. Please consult with doctor before having pizza's." else @customer_data[prod.id] << " How's your health." if (@medical_confirmation.foodHabit == prod.foodType) @customer_data[prod.id] << " This is your favorite food type." if (@medical_confirmation.allergens == prod.allergens) #&& @medical_confirmation.userName == @user_medical_check.firstName) @customer_data[prod.id] << " But You must choose different food. Since this is allergic to you." else @customer_data[prod.id] << " Good Choice." if(prod.calorie>250) @customer_data[prod.id] << " Do exercise to burn #{prod.calorie} calories accordingly" else @customer_data[prod.id] << " Have a healthy life." end end else @customer_data[prod.id] << " Regret!, this is #{prod.foodType}, pls check other products." end end end return @customer_data end