Created
March 2, 2018 19:07
-
-
Save arpit/265f68c74bd069d3ef4bbc495e813eca to your computer and use it in GitHub Desktop.
Modeling Twitter
This file contains 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
#The goal of this exercise is to create the models for a app like Twitter. We are not going to use Rails, just plain old Ruby. | |
#The goal is to be able to generate timelines for each user. The final code should look like this: | |
twitter = Twitter.new | |
user1 = User.new("alice") | |
user1.tweet("hello world") | |
user1.tweet("So hungry today") | |
user2 = User.new("bob") | |
user2.tweet("Its a nice day") | |
user2.tweet("Yay for ice cream") | |
user1.follow(user2) | |
user1.get_timeline #should return an array of strings of bobs tweets since user1 only follows user2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment