From 69b176c3d5f0f04eb4307137742d20b87993530d Mon Sep 17 00:00:00 2001 From: timsvoice Date: Tue, 13 May 2014 17:42:17 -0400 Subject: [PATCH] panda challenge with struct --- models/automobile.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 models/automobile.rb diff --git a/models/automobile.rb b/models/automobile.rb new file mode 100644 index 0000000..74afdda --- /dev/null +++ b/models/automobile.rb @@ -0,0 +1,24 @@ +automobile = {} +automobile[:color] = "white" +automobile[:make] = "mini" +automobile[:year] = 1999 + +class Vehicle +end + +Automobile = Struct.new(:automobile) do + def wheels(wheels) + puts "has #{wheels} wheels" + end +end + +automobile = Automobile.new( {color: "Blue", make: "Mazda", year: 2010} ) + +puts "Automobile" +automobile.automobile.each do |key, value| + puts "* #{key}: #{value}" +end + +puts "\nWheels" +puts "#{automobile.wheels(4)}" +