-
-
Save dmehrotra/6359012 to your computer and use it in GitHub Desktop.
car.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Car | |
| class << self | |
| @@make_table = {} | |
| def add_make(make_model) | |
| make_model.each do |key, value| | |
| @@make_table[key] = value | |
| end | |
| end | |
| def valid_make?(make) | |
| @@make_table.has_key?(make) | |
| end | |
| def valid_model?(make, model) | |
| @@make_table[make].include?(model) | |
| end | |
| end | |
| end | |
| # I couldn't finish this without looking....so this is as far as I got without looking at Dan's answers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment