Welcome! Today, we’re diving into an exciting project that involves managing employee records within a company. Specifically, we’ll use nested hashes and arrays in Ruby to add projects and tasks for employees and retrieve those tasks as needed. This exercise will help you understand how to manipulate nested data structures effectively in Ruby.
We'll implement three methods in our EmployeeRecords
class:
add_project(employee_id, project_name)
- Adds a new project to an employee's list of projects. If the project already exists for that employee, the method returnsfalse
. Otherwise, it adds the project and returnstrue
.add_task(employee_id, project_name, task)
- Adds a new task to a specified project for an employee. If the project does not exist for that employee, the method returnsfalse
. If the task is added successfully, it returnstrue
.get_tasks(employee_id, project_name)
- Retrieves all tasks for a specified project of an employee. If the project does not exist for that employee, the method returnsnil
. Otherwise, it returns the list of tasks.
