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
21 changes: 9 additions & 12 deletions recipe.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
ingredients = {}
ingredients[:avocados] = 4
ingredients[:jalapenos] = 2
train = {}
train[:Destination] = "New York"
train[:Engines] = 4
train[:Cars] = 20
train[:Caboose] = "Yes we have one!"

Recipe = Struct.new(:ingredients, :method)
Passenger = Struct.new(:name, :train)

recipe = Recipe.new( {avacados: 4, jalapenos: 2}, ["Peel / Slice Avocados", "Chop jalapenos into small dice"])
passenger = Passenger.new( "Matz", {Destination: "New York", Engines: 4, Cars: 20, Caboose: "Yes we have one!"})

puts "ingredients"
recipe.ingredients.each do |key, value|
puts "There is a passenger named #{passenger.name} on a train with the following details:"
passenger.train.each do |key, value|
puts "* #{key}: #{value}"
end

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