Created
January 26, 2010 17:44
-
-
Save ebot/287035 to your computer and use it in GitHub Desktop.
Taco Bell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# | |
# A practical example of using modules is the process of making tacos. | |
# There are 4 main modules: main, Ingredients, Prep, and Serve | |
# | |
module TacoBell | |
class Tacos | |
def initialize(style = "Mild") | |
@style = style | |
end | |
def get_recipe() | |
if @style == "Hot\n" | |
puts "Run for the Border!" | |
elsif @style == "Mild\n" | |
make_tacos() | |
# Display the Ingredients required for making Tacos. | |
puts "\nPress a key to see Ingredients." | |
gets | |
get_ingrediants() | |
# Display Prep. | |
puts "\nPress a key to see the Prep." | |
gets | |
how_to_prep() | |
# Display Serve. | |
puts "\nPress a key to see how to Serve." | |
gets | |
how_to_serve() | |
end | |
end | |
private | |
def make_tacos | |
puts "\nThis is how you make Tacos." | |
end | |
def get_ingrediants | |
puts "These are the ingredients you need for making tacos:\n" | |
puts " Ground beef or Ground turkey." | |
puts " 2 Large Tomatoes." | |
puts " 1 Head of Lettuce." | |
puts " 1 cup of cheese (whatever kind you like)." | |
puts " 1 tablespoon of Taco Seasoning." | |
end | |
def how_to_prep | |
puts " Brown the ground meat," | |
puts " meanwhile, " | |
puts " Dice the tomatoes." | |
puts " Shred the lettuce." | |
puts " Warm the taco shells." | |
puts " Grate the cheese." | |
puts " Drain the ground meat and add taco seasoning." | |
end | |
def how_to_serve | |
puts " Fill taco shell with ground meat." | |
puts " Top ground meat with diced tomatoes," | |
puts " shredded lettuce and grated cheese." | |
end | |
end | |
end | |
puts "What type of tacos?" | |
type = gets | |
t = TacoBell::Tacos.new(type) | |
t.get_recipe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment