Skip to content

Instantly share code, notes, and snippets.

@dmehrotra
Created August 27, 2013 20:52
Show Gist options
  • Select an option

  • Save dmehrotra/6359012 to your computer and use it in GitHub Desktop.

Select an option

Save dmehrotra/6359012 to your computer and use it in GitHub Desktop.
car.rb
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