This is the fifth project of the fourth module in the Microverse program.
Check the below contents for further details about this project.
The project follows Object Oriented Programming using Ruby.
This repository includes ten class files (Person / Student / Teacher / Classroom / Book / Rental / Nameable / Decorator / Capitalize / Trimmer).
Special class App for handling all app operations and a file main.rb as entry point for it.
Module Storage used for handling JSON files read & write.
Decorator design pattern is implemented for adding several operations on name variable in Person class.
Several associations exist bewteen some classes.
All data is preserved inside three files (books.json / people.json / rentals.json).
Unit testing is carried on ten classes (Person / Student / Teacher / Classroom / Book / Rental / Nameable / Decorator / Capitalize / Trimmer).
Every method in the above classes has an example test case inside specs directory.
📌 Tech Stack:
- Code built with
Ruby - Unit tests uses
RSpec - Linting is done with
Rubocop
📌 Key Features:
- Class
Nameableis a parent class for bothPerson&Decorator - Class
Personis a parent class for bothStudent&Teacher - Class
Decoratoris a parent class for bothCapitalize&Trimmer - Class
Personincludes a constructor & four methods - Constructor in
Personclass includes three arguments (age/name/parent_permission) - First method in
Personclass is a public method calledadd_rental - Second method in
Personclass is a public method calledcan_use_services - Third method in
Personclass is an unherited method calledcorrect_name - Fourth method in
Personclass is a private method calledof_age - Class
Studentincludes a constructor & four methods - Constructor in
Studentclass includes three arguments (classroom/age/name/parent_permission) - First method in
Studentclass is a public method calledplay_hooky - Second method in
Studentclass is a static method calledinput_arguments - Third method in
Studentclass is a public method calledgenerate_string - Fourth method in
Studentclass is a static method calledparse_string - Constructor in
Teacherclass includes three arguments (specialization/age/name/parent_permission) - First method in
Teacherclass is a public method that overridescan_use_servicesfrom parent class - Second method in
Teacherclass is a static method calledinput_arguments - Third method in
Teacherclass is a public method calledgenerate_string - Fourth method in
Teacherclass is a static method calledparse_string - Class
Nameableincludes one methodcorrect_namethat raises an exception - Class
Decoratorincludes only constructor that passes aNameableobject - Class
Capitalizeincludes one inherited methodcorrect_name& overrides it - Class
Trimmerincludes one inherited methodcorrect_name& overrides it - Class
Classroomincludes a constructor & three methods - Constructor in
Classroomincludes one argumentlabel - First method in
Classroomclass is public methodadd_student - Second method in
Classroomclass is a public method calledgenerate_string - Third method in
Classroomclass is a static method calledparse_string - Class
Bookincludes a constructor & three methods - Constructor in
Bookincludes two arguments (title/author) - First method in
Bookclass is public methodadd_rental - Second method in
Bookclass is a public method calledgenerate_string - Third method in
Bookclass is a static method calledparse_string - Class
Rentalincludes only one constructor & three methods - First method in
Rentalclass is a static method calledinput_arguments - Second method in
Rentalclass is a public method calledgenerate_string - Third method in
Rentalclass is a static method calledparse_string - Constructor in
Bookincludes three arguments (date/book/person) - First method in
Bookclass is a static method calledinput_arguments - Second method in
Bookclass is a public method calledgenerate_string - Third method in
Bookclass is a static method calledparse_string - Class
Appincludes a constructor & twelve methods - Constructor in
Appinitializes several empty arrays - Entry point in
main.rbfile with infinite loop - Module
Storageincludes two methods (read_file/write_file)
You can easily download or fork this repository and work on it immadiately!
📌 Prerequisites:
- You need
Rubylanguage installed
📌 Installation:
- To install all gem dependencies run
bundle install
📌 Development:
- Run
main.rbfile with
ruby main.rb
📌 Tests:
- To run unit tests navigate to
specsdirectory and run:
rspec . -f d
📌 Mahammad:
📌 Alexander:
📌 Austin:
Some additional features I may implement in the project:
- Implement better visual interface
Wish to contribute to this project?
Contributions, issues, and feature requests are more than welcome!
Feel free to check the issues page too.
Like this project? Show your support by starring!
I thank everyone at Microverse for guiding me through this project.
This project is MIT licensed.