class DailyRecipe::CLI

our CLI controller

Public Instance Methods

call() click to toggle source
# File lib/daily_recipe/cli.rb, line 5
def call
  puts "Here are today's Daily Recipes"
  list_recipes
  menu
end
goodbye() click to toggle source
# File lib/daily_recipe/cli.rb, line 47
def goodbye
  puts "Please visit again for more amazing recipes!"
end
list_recipes() click to toggle source
# File lib/daily_recipe/cli.rb, line 11
def list_recipes
  #will get recipes
  @recipes = DailyRecipe::Recipe.today
  rows = [] # terminal-table formatting
  rows << ["Number", "Recipe Name", "Rating", "Cooking Time"]
  @recipes.each.with_index(1) do |recipe, i|  #There is a Recipe class with a #today method for today's recipes
    rows << [i, recipe.name, "#{recipe.rating} / 5", recipe.cook_time]
  end
  table = Terminal::Table.new :rows => rows #AWESOME!
  puts table
end
menu() click to toggle source