Class: WeeklyPlan

Inherits:
Plan
  • Object
show all
Defined in:
lib/weekly_plan.rb

Instance Method Summary collapse

Methods inherited from Plan

#budget, #get_price, #get_user_menu

Instance Method Details

#generate_meal_plan(context) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/weekly_plan.rb', line 5

def generate_meal_plan(context)
    @user = context.user
    @menu = context.menu
    @budget = context.budget
    meal_plan = Array.new
    7.times do |n|
        meal_plan.push({
            :breakfast => get_user_menu(get_price(context.BREAKFAST_PERCENT), context.BREAKFAST_IDENTIFIER).sample,
            :lunch => get_user_menu(get_price(context.LUNCH_PERCENT), context.LUNCH_IDENTIFIER).sample,
            :dinner => get_user_menu(get_price(context.DINNER_PERCENT), context.DINNER_IDENTIFIER).sample
        })
    end
    return meal_plan
end