Giter VIP home page Giter VIP logo

library-challenge's Introduction

##Library Challenge ###Week 1 Ruby challenge

Instructions

This is a simulation for a library system. A person can borrow books from the library. The library can lend books which are available.

###Prerequisite

  • Ruby version : 2.2.3 This project uses Ruby 2.2.3 in the Gemfile. So you need to have Ruby 2.2.3 installed in your system.
$rvm list

So if you currently use Ruby 2.3.0, you can switch to Ruby 2.2.3 by the following command.

$rvm use 2.2.3

###User stories

#####This Library program has the following user stories:

As an individual
In order to get my hands on a good book
I would like to see a list of books currently available in the library
with information about the title and author
As a library
In order to have good books to offer to the public
I would like to be able to have a collection of books
As a library
In order to have good books to offer to the public
I would like to be able to allow individuals to check out a book
As a library
In order to make the books available to many individuals
I would like to set a return date on every check out
and I would like that date to be 1 month from checkout date
As an individual
In order to avoid awkward moments at the library
I would like to know when my book is supposed to be returned

###How to use the program in irb

  • Step 1: Go to the terminal in your Mac or Linux and start the irb with the following command
$irb
  • Step 2: Load YAML because it is used for loading the data files in yml formatted
> require 'yaml'
  • Step 3: Load the person.rb files
> load './lib/person.rb'
  • Step 4: Create a new person instance. Two books are loaded into the person's bookshelf.
> person = Person.new
  • Step 5: Create a new library instance. Books are loaded into the library.
> library = Library.new
  • Step 6: Let the person check out a book 'Alfons och soldatpappan'
> person.checkout(title:'Alfons och soldatpappan', lib:library)
  • Step 7: Show the person's bookshelf has got the book 'Alfons och soldatpappan'
> puts person.bookshelf
  • Step 8: Return the book. The amount of books on the bookshelf should become 2, which is shown in the output.
> person.return_book(title:'Alfons och soldatpappan', 'lib':library)

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.