From 238ae839744171d1b4ed23ffc434ac78d31daad9 Mon Sep 17 00:00:00 2001 From: lorail Date: Sun, 25 Aug 2013 20:45:19 -0400 Subject: [PATCH 1/3] Train hash and passenger struct --- passenger2.rb | 15 +++++++++++++++ train.rb | 22 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 passenger2.rb create mode 100644 train.rb diff --git a/passenger2.rb b/passenger2.rb new file mode 100644 index 0000000..a5032fc --- /dev/null +++ b/passenger2.rb @@ -0,0 +1,15 @@ +def name + name = "Lori" +end + +def city + city = "New York" +end + +Passenger = Struct.new(:city, :name) + +lori = Passenger.new + +puts "Passenger: #{name}, #{city}" + + diff --git a/train.rb b/train.rb new file mode 100644 index 0000000..4c54d65 --- /dev/null +++ b/train.rb @@ -0,0 +1,22 @@ +train = {} +train[:city] = "New York" +train[:engines] = 1 +train[:cars] = 6 + +train_parts = {} +train_parts[:train] = train + +puts "Train:" +train_parts[:train].each do |key, value| + puts " * #{key}: #{value}" +end + +puts " * and a caboose." + +Passenger = Struct.new(:city, :name) + +passenger = Passenger.new +passenger[:name] = "Lori" + +puts "#{name} is on the #{city} train." + From 88f26c7f7046bdb18fd85bfa9051ab7c5b2854f5 Mon Sep 17 00:00:00 2001 From: lorail Date: Sun, 25 Aug 2013 20:49:04 -0400 Subject: [PATCH 2/3] Remove notes for passenger --- train.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/train.rb b/train.rb index 4c54d65..1b5a0d0 100644 --- a/train.rb +++ b/train.rb @@ -13,10 +13,4 @@ puts " * and a caboose." -Passenger = Struct.new(:city, :name) - -passenger = Passenger.new -passenger[:name] = "Lori" - -puts "#{name} is on the #{city} train." From 47fbf6c6657df580261bd9ba411ea2b07a4047e0 Mon Sep 17 00:00:00 2001 From: lorail Date: Tue, 27 Aug 2013 17:30:51 -0400 Subject: [PATCH 3/3] Add passenger3 and new train --- .DS_Store | Bin 0 -> 6148 bytes passenger.rb | 16 ++++++++++++++++ passenger3.rb | 6 ++++++ train.rb | 5 ++--- 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .DS_Store create mode 100644 passenger.rb create mode 100644 passenger3.rb diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a2dd83efb711a8780adc8ac57b2e2f05b5eae52c GIT binary patch literal 6148 zcmeHKy=uci43<(4fh^hD@t&ZNH#ma(1cAz?Q*e-=IP&TG47cJFc=Jkug8F+wO13WNfoKq&CU3ZQ3;EmwvSLxE5r z6u2uO--iSj%#OuSKOG1<0s!SVUJcheO8}E3fZ4GaA_HTi0*%T(VzAMXPhOWDi=okp zefVI%Gy8g9|A5cT|6@|DLV-}=p%mb%-ql;YlK0lh x%So?I@GtnEp;pTgv=sxj6=NZ-_-#;^