Skip to content

Instantly share code, notes, and snippets.

@sinthetix
Created November 7, 2013 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinthetix/7357820 to your computer and use it in GitHub Desktop.
Save sinthetix/7357820 to your computer and use it in GitHub Desktop.
Just a silly little personal chef program I made with the help of this tutorial: http://tutorials.jumpstartlab.com/projects/ruby_in_100_minutes.html
class PersonalChef
def make_toast(color)
if color.nil?
puts "Guess you're getting burnt toast!"
else
puts "Making your toast #{color}!"
end
return self
end
def make_milkshake(flavor)
if color.nil?
puts "I feel like making you a strawberry milkshake."
else
puts "Making your #{flavor} milkshake!"
end
return self
end
def make_eggs(quantity)
quantity.times do
puts "Making an egg."
end
puts "I'm done!"
return self
end
def gameplan(meals)
meals.each do |meal|
puts "we'll have #{meal}..."
end
all_meals = meals.join(", ")
puts "Our meal summary: #{all_meals}"
end
def inventory
produce = {apples: 3, oranges: 1, carrots: 12}
produce.each do |item, quantity|
puts "There are #{quantity} #{item} in the fridge."
end
end
def water_status(minutes)
if minutes < 7
puts "The water is not boiling yet."
elsif minutes == 7
puts "It's just barely boiling."
elsif minutes == 8
puts "It's boiling!"
else
puts "Hot! Hot! Hot!"
end
return self
end
def egg_timer(minutes)
while minutes > 0
puts "There are #{minutes} left until the eggs are done."
minutes = minutes - 1
end
return self
end
def toaster_timer(seconds)
until seconds == 0
puts "There are #{seconds} seconds left!"
seconds = seconds - 1
end
if seconds == 0
puts "Ding! Toast is done!"
end
return self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment