Skip to content

Instantly share code, notes, and snippets.

@swooop
Last active December 15, 2015 15:59
Show Gist options
  • Save swooop/5286041 to your computer and use it in GitHub Desktop.
Save swooop/5286041 to your computer and use it in GitHub Desktop.
Shelter app musings...
#Happi Tails
class Shelter
attr_accessor(:Person, :Animal)
def initialize
@person = {}
@animal = {}
end
def add_new_client(name, options = {})
@person[name] = Person.new(name, options)
end
def add_new_animal(name, options = {})
@animal[name] = Animal.new(name, options)
end
end
class Person
attr_accessor(:name, :age, :gender, :no_of_kids, :no_of_pets)
def initialize(name, options = {})
@name = name
@age = options [:age]
@gender = options [:gender]
@no_of_kids = options [:gender]
@no_of_pets = options [:no_of_pets]
end
end
class Animal
attr_accessor(:name, :breed, :age, :fav_toy)
def initialize(name, options = {})
@name = name ||= "Pet"
@breed = options [:breed]
@age = options [:age]
@fav_toy = options [:fav_toy]
end
end
def show_animal
@animal.each do |ind, animal|
puts "#{ind}: #{animal}"
end
end
def show_people
for person in @people
puts person.name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment