Skip to content

Instantly share code, notes, and snippets.

@arpit
Created March 2, 2018 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arpit/265f68c74bd069d3ef4bbc495e813eca to your computer and use it in GitHub Desktop.
Save arpit/265f68c74bd069d3ef4bbc495e813eca to your computer and use it in GitHub Desktop.
Modeling Twitter
#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