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
Nameable
is a parent class for bothPerson
&Decorator
- Class
Person
is a parent class for bothStudent
&Teacher
- Class
Decorator
is a parent class for bothCapitalize
&Trimmer
- Class
Person
includes a constructor & four methods - Constructor in
Person
class includes three arguments (age
/name
/parent_permission
) - First method in
Person
class is a public method calledadd_rental
- Second method in
Person
class is a public method calledcan_use_services
- Third method in
Person
class is an unherited method calledcorrect_name
- Fourth method in
Person
class is a private method calledof_age
- Class
Student
includes a constructor & four methods - Constructor in
Student
class includes three arguments (classroom
/age
/name
/parent_permission
) - First method in
Student
class is a public method calledplay_hooky
- Second method in
Student
class is a static method calledinput_arguments
- Third method in
Student
class is a public method calledgenerate_string
- Fourth method in
Student
class is a static method calledparse_string
- Constructor in
Teacher
class includes three arguments (specialization
/age
/name
/parent_permission
) - First method in
Teacher
class is a public method that overridescan_use_services
from parent class - Second method in
Teacher
class is a static method calledinput_arguments
- Third method in
Teacher
class is a public method calledgenerate_string
- Fourth method in
Teacher
class is a static method calledparse_string
- Class
Nameable
includes one methodcorrect_name
that raises an exception - Class
Decorator
includes only constructor that passes aNameable
object - Class
Capitalize
includes one inherited methodcorrect_name
& overrides it - Class
Trimmer
includes one inherited methodcorrect_name
& overrides it - Class
Classroom
includes a constructor & three methods - Constructor in
Classroom
includes one argumentlabel
- First method in
Classroom
class is public methodadd_student
- Second method in
Classroom
class is a public method calledgenerate_string
- Third method in
Classroom
class is a static method calledparse_string
- Class
Book
includes a constructor & three methods - Constructor in
Book
includes two arguments (title
/author
) - First method in
Book
class is public methodadd_rental
- Second method in
Book
class is a public method calledgenerate_string
- Third method in
Book
class is a static method calledparse_string
- Class
Rental
includes only one constructor & three methods - First method in
Rental
class is a static method calledinput_arguments
- Second method in
Rental
class is a public method calledgenerate_string
- Third method in
Rental
class is a static method calledparse_string
- Constructor in
Book
includes three arguments (date
/book
/person
) - First method in
Book
class is a static method calledinput_arguments
- Second method in
Book
class is a public method calledgenerate_string
- Third method in
Book
class is a static method calledparse_string
- Class
App
includes a constructor & twelve methods - Constructor in
App
initializes several empty arrays - Entry point in
main.rb
file with infinite loop - Module
Storage
includes two methods (read_file
/write_file
)
You can easily download or fork this repository and work on it immadiately!
📌 Prerequisites:
- You need
Ruby
language installed
📌 Installation:
- To install all gem dependencies run
bundle install
📌 Development:
- Run
main.rb
file with
ruby main.rb
📌 Tests:
- To run unit tests navigate to
specs
directory 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.