Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 51 additions & 12 deletions recipe.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,56 @@
ingredients = {}
ingredients[:avocados] = 4
ingredients[:jalapenos] = 2
# ingredients = {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of commenting out lines, you should just delete them. You can always go back to a previous commit in Git.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. This was just to see the progress of coding. For example in the videos you show a simple solution then a refactored solution. Being able to see the transition helps me. But I could look at them in the commits.

# ingredients[:avocados] = 4
# ingredients[:jalapenos] = 2

Recipe = Struct.new(:ingredients, :method)
# Recipe = Struct.new(:ingredients, :method)

recipe = Recipe.new( {avacados: 4, jalapenos: 2}, ["Peel / Slice Avocados", "Chop jalapenos into small dice"])
# recipe = Recipe.new( {avacados: 4, jalapenos: 2}, ["Peel / Slice Avocados", "Chop jalapenos into small dice"])

puts "ingredients"
recipe.ingredients.each do |key, value|
puts "* #{key}: #{value}"
# puts "ingredients"
# recipe.ingredients.each do |key, value|
# puts "* #{key}: #{value}"
# end

# puts "\nMethod"
# recipe.method.each_with_index do |step, index|
# puts "#{index+1}. #{step}"
# end


current_city = {}
current_city[:number] = 1
current_city[:picture] = 'Charleston '

engines = {}
engines[:number] = 2
engines[:picture] = "<T--H"

cars = {}
cars[:number] = 20
cars[:picture] = "-OOO"

caboose = {}
caboose[:number]=1
caboose[:picture]="-###>"

train = {}
train[:current_city] = current_city
train[:engines]= engines
train[:cars]=cars
train[:caboose]=caboose

Passenger = Struct.new(:name,:train)
passenger = Passenger.new('Noah',train)

# puts passenger.name
# puts passenger

def draw_train(train)
puts "Here is your train:"
train.each do |key,index|
print "#{index[:picture]*index[:number]}"
end
end

puts "\nMethod"
recipe.method.each_with_index do |step, index|
puts "#{index+1}. #{step}"
end
draw_train(train)