Giter Site home page Giter Site logo

reading-is-fundamental's Introduction

Reading Is Fundamental

Iteration 1

Use TDD to create a Review class that responds to the following interaction pattern:

Reviews should have a precision to the tenth place.

pry(main)> require './lib/review'
# => true

pry(main)> review = Review.new({name: "Aral Nuraduum", score: "4.5"})
# => #<Review:0x00007fd8273d21e0...>

pry(main)> review.reviewer_first_name
# => "Aral"

pry(main)> review.reviewer_last_name
# => "Nuraduum"

pry(main)> review.score
# => 4.5

Iteration 2

Use TDD to create a Book class that responds to the following interaction pattern:

  • #reviews returns an array of review objects that belong to the book.
pry(main)> require './lib/review'
# => true


pry(main)> require './lib/book'
# => true

pry(main)> book = Book.new({title: 'Practical Object Oriented Design in Ruby', author: 'Sandi Metz'})
# => #<Book:0x00007fe0d0851138...>

pry(main)> book.title
# => 'Practical Object Oriented Design in Ruby'

pry(main)> book.author
# => 'Sandi Metz'

pry(main)> book.read?
# => false

pry(main)> book.read = true

pry(main)> book.read?
# => true

pry(main)> review_1 = Review.new({name: "Aral Nuraduum", score: "3.5"})
# => #<Review:0x00007fd8273d21e0...>

pry(main)> review_2 = Review.new({name: "Aniz Arazak", score: "5.0"})
# => #<Review:0x0012fdabcd3d21e0...>

pry(main)> book.add_review(review_1)

pry(main)> book.add_review(review_2)

pry(main)> book.reviews
# => [#<Review:0x00007fd8273d21e0...>, #<Review:0x0012fdabcd3d21e0...>]

pry(main)> book.reviews_greater_than(3)
# => [#<Review:0x00007fd8273d21e0...>, #<Review:0x0012fdabcd3d21e0...>]

pry(main)> book.reviews_greater_than(4)
# => [#<Review:0x0012fdabcd3d21e0...>]

Iteration 3

Use TDD to create a BookClub object.

  • A BookClub has a name.
  • You can add Book objects to a BookClub
  • There is a method #read_books on BookClub that will return an array of Book objects that have been read.
  • There is a method #unread_books on BookClub that will return an array of Book objects that have not been read.
  • There is a method #average_reviews_per_book on BookClub that will return a float to one decimal point of the number of average reviews per book.
  • There is a method #authors on BookClub that returns a hash where the keys are the authors names as strings, and the values are arrays of Book Objects written by that author.

Iteration 4

These methods all belong to BookClub.

  • #most_prolific_reviewer is a method on BookClub that returns a hash. The key is a string with the name of the person who has written the most reviews, and the value is an array of all of their Review objects.

reading-is-fundamental's People

Contributors

mikedao avatar

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.