Episode 7 - Converting Hashes To Objects
Recreate the Person class in your own text editor.
- Add a method called full_name that returns the person’s full name as a string.
- Add a method called email that returns the person’s email address as a string. The person’s email is has the format: “email@example.com".
- Add a method called info that returns a string that describes the person in a user friendly format. The catch: Make sure it works no matter how many hobbies a person has! (Hint: Consider using an each loop.)
Below the Person class, create a ContactList class. The ContactList should have two attributes:
title - this represents what list this is (e.g. “friends”, “business contacts”)
contacts - this should be an array. It will contain numerous instances of the Person class.
Add an instance method to the ContactList class called “add_contact” that will add a Person instance to the particular contact list.