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
22 changes: 11 additions & 11 deletions recipe.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
ingredients = {}
ingredients[:avocados] = 4
ingredients[:jalapenos] = 2
train = {}
train[:engines] = 4
train[:current_city] = "Columbus"
train[:number_of_cars] = 15
train[:caboose] = true

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

recipe = Recipe.new( {avacados: 4, jalapenos: 2}, ["Peel / Slice Avocados", "Chop jalapenos into small dice"])
passenger = Passenger.new({engines: 4, current_city: "Columbus", number_of_cars: 2, caboose: true}, ["Maurice Womack"])
Copy link
Member

Choose a reason for hiding this comment

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

Curious: why use an array for ["Maurice Womack"] ?

Copy link
Author

Choose a reason for hiding this comment

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

Got confused and didn't remove the brackets.


puts "ingredients"
recipe.ingredients.each do |key, value|
puts "train information"
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
puts "\nName:"
puts passenger.name