Code Monkey home page Code Monkey logo

upperline-hs-intro-software-engineering-pinterest-todo's Introduction

Keep on Pinning

Pinterest has just over 72.8 million users. Obviously, they don't have separate files to write the code for almost 80 million users. Today, you're going to recreate Pinterest's User class.

Let's Get Started

You'll be coding your solution in lib/pinterest.rb

1. Create a User class.

2. Users should have name, email address, password attributes. Users should be able to change their name and email address, so you'll want reader and writer methods for those attributes. But we don't want our users to be able to view their password, so we'll just need a writer for password

3. We also want the name, email address, and password attributes to be passed to initialize. You'll need to define an initialize method that accepts three arguments.

4. The best part about pinterest is pinning things, and then looking at the things you've pinned. Let's think about the best way to store the things we've pinned. Should it be an array or a hash? You decide. Just make sure you create a new attribute my_pins to store the pins. You'll want this attribute to store either an empty array or hash on initialization.

5. We need a pin_it method now. That is the main action users take on pinterest. Define a pin_it method that adds a pin to a users my_pins attribute. This method should accept an argument (the pin you're pinning).

6. Now users need to be able to delete pins. Define a delete_pin method. This method should accept an argument, which is the pin you want to delete. The method should check to make sure you did in fact originally pin that item, and delete it if you did. If you didn't, it should return "You never pinned that pin."

7. Make sure you submit the lesson!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.